Open rohitkandhal opened 9 years ago
It's because of this issue: https://egghead.io/lessons/angularjs-the-dot
It's because of variable "hiding" that happens when setting a variable on child scopes.
Sent from my iPhone
On Apr 12, 2015, at 4:13 PM, Rohit Kandhal notifications@github.com wrote:
One slide states Always bind to a property of a child object. I assume it's applicable only for objects defined on scope, not arrays or properties.
— Reply to this email directly or view it on GitHub.
Thank you @brockallen, @spmorgan. Egghead tutorial is interesting. Also noticed, if I define data.message
property in my controller then it is not shared.
If I define data.message
object/property on scope like following, then it's not shared.
function FirstCtrl($scope) { $scope.data = { "message" : "test 1" }; }
function SecondCtrl($scope) { $scope.data = { "message" : "test 2" }; }
I believe this difference is pointed out at the end of video. I am wondering how I'll access the model in controller, if not using $scope
. How should I read data.message
in controller?
One slide states
Always bind to a property of a child object
. I assume it's applicable only forobjects
defined on scope, notarrays
orproperties
.