populate document from angular controller