Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to init a widget from a controller when it's exposed to the parent scope #1

Open
tkrugg opened this issue May 21, 2014 · 0 comments

Comments

@tkrugg
Copy link
Member

tkrugg commented May 21, 2014

Currently, when a widget is exposed to the parent scope, it is not possible to initialise it from the controller.

<div ng-controller="MainCtrl">
   <ng-star-rating data-id="rate"></div><!-- widget is exposed to $scope -->
</div>
function MainCtrl($scope) {
    $scope.rate.value = 3;        // this will fail because $scope.rate is undefined
    $scope.setRate = function(v){
         $scope.rate.value = v;  // this will work as it's executed after the directive is initialized
    }
}
tkrugg pushed a commit that referenced this issue May 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant