Hi Tahir,

Well, you should start of with filing an issue with those 3rth parties. 
This is a serious design flaw on their part. (Granted: Before ng-europe 
2014, nobody expected $scope to disappear!), but with our current 
knowledge, this should be fixed. (and it is an easy fix for 95% of the 
cases!)

However, in the mean time, this leaves you with the need to inject the 
scope into your component. There is little trick to do just that. $scope is 
not available at the time of the controllers creation. (as you probably 
have figured this out) so you can not inject it directly.

Still, $scope is available for injection to the activate life-cycle-hook. 
You can then hook it up to your controller, and you can access it as much 
as you need. 
something like this will work: (typed up in here, probably needs some 
debugging an annotations to actually work!)

    function WelcomeController() {
        var vm=this;
        console.log('Yay');
        vm.hello='Welcome welcomes you!';
    }
    
    WelcomeController.prototype.activate = function ($scope) {
        this.scope = $scope
    }
    WelcomeController.prototype.activate.$inject = ['$scope'];

However, while this is working, it is clearly not a clean path forward. Try 
to avoid constructions like this as much as possible. The problem with 
$scope is that you can't see from your template/js where a value is 
originating from. That alone makes it a maintenance issue in the long run.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to