Angular component resolve binding is defined


I have a controller that instantiates a Restangular object.'doctors', profile_id).get().then(function(resp) {
  $ = resp;

I also have a component that would like to wait for $ to be defined before it is instantiated. How can I ensure doctor is defined?

app.component('doctorReviews', {
  bindings: {
    doctor: '='
  controller: function() {

    var self = this;'reviews').then(function(resp) { = _.sortBy(resp, 'separation')



you could add ng-if='doctor != null' in your page template to ensure doctorReviews initialized after doctor defined:

//somewhere in your page html...
<doctor-reviews ng-if='doctor != null'></doctor-reviews>

Answered By – MarkoCen

Answer Checked By – Katrina (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.