I understand that, what I am talking about is the 2 way binding using the
"=" sign when declaring an isolate scope in a directive. I left out all the
other code to make it simpler, sorry about the confusion.
.directive("myDirective", [function() {
return {
restrict: "E",
scope: {
myObject: "=", // This works
'myObject.myProp': "=" // This does not, would like to
create the binding with just myProp and not the whole myObject
},
link: function (scope, element, attrs) {
},
templateUrl: "blablah/blah.html"
};
}])
On Tuesday, January 14, 2014 7:37:09 PM UTC-8, Sander Elias wrote:
>
> Hi Warish,
>
> This is how javascript works! Nothing angular can do about that.
> Still, this is working, however, not the way you think.
> If you want access to the property, you need to do something like this:
> scope['myObject.myProperty'] in your code.
> This is called a string
> literal<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#String_literals>.
>
> String literals are valid as property names for objects,
>
> 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/groups/opt_out.