You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Since I updated my angular project from ~1.3 beta 17 to 1.3 rc.1 the controllerAs behavior is no longer working as expected, I am not sure if this is due an intended change, but I couldn't find any breaking changes in the changelog in relation to controllerAs, so being unsure I'll describe this issue just in case that it is indeed a bug.
Scenario:
Have a directive with a controller and controllerAs ("Dock") property.
Instead of using this.myFn = function(){}; I'm using:
var stuff = {
myFn: function(){}
};
return stuff;
Logging the scope appears empty with the only property being "Dock", also empty.
Have a link function in the directive accessing the scope like: scope.myFn(); = undefined.
Expected scope:
{
Dock: {
myFn : function(){}
}
}
To make myself clear, this worked just fine in (1.3 beta 17 IIRC).
Workaround:
In controller use this.myFn = function(){};
In link use this.Dock.myFn(); (worked as this.myFn even with controllerAs before update).
Expected behavior: returning an object from the controller function to work the same as adding a function to the "this" property.
The text was updated successfully, but these errors were encountered:
the return value of controller constructors in directives is now ignored --- this was a breaking change, and is mentioned in the changelog, with suggested alternatives (sorry about the breaking change, there was no other way to do it --- we needed to make sure that we could get the controller instance before calling the constructor function, and the only way to do that is to allocate the controller instance ourselves and ignore the result of the constructor...)
Since I updated my angular project from ~1.3 beta 17 to 1.3 rc.1 the controllerAs behavior is no longer working as expected, I am not sure if this is due an intended change, but I couldn't find any breaking changes in the changelog in relation to controllerAs, so being unsure I'll describe this issue just in case that it is indeed a bug.
Scenario:
var stuff = {
myFn: function(){}
};
return stuff;
Expected scope:
{
Dock: {
myFn : function(){}
}
}
To make myself clear, this worked just fine in (1.3 beta 17 IIRC).
Workaround:
In controller use this.myFn = function(){};
In link use this.Dock.myFn(); (worked as this.myFn even with controllerAs before update).
Expected behavior: returning an object from the controller function to work the same as adding a function to the "this" property.
The text was updated successfully, but these errors were encountered: