I wrote a directive that takes in a parameter like twoWords (camel case) and when I try to pull in the variable from scope in a controller, it doesn't work. One the other hand, twowords works perfectly.
//part of my directive
var controller = ['$scope', function ($scope) {
console.log($scope.twoWords); //this doesn't work
console.log($scope.twowords); //this works
}];
return {
restrict: 'EA',
scope: {
twoWords: '=',
twowords: '='
},
controller: controller,
templateUrl: template
}
In the markup camel case becomes a hyphenated version twoWords becomes two-words. Show your template if you're still having an issue.
Oh, facepalm. I didn't think about that. Thanks!
No problem not sure if it's explicitly stated here or not https://docs.angularjs.org/guide/directive#matching-directives but the same thing that applies to directives applies to the scope properties as well in terms of the matching, can probably close the issue if that fixes it (not sure how this all works on github tbh)
i have the same issue, keep failing to pass variables to components using bindings, until I found out only need to change my variables from 'isLiked' to 'isliked'...spent 2 days intensive reading and trying different ways to solve the problem, i think this should be highlight in tutorials / blog posts for beginners
Most helpful comment
i have the same issue, keep failing to pass variables to components using bindings, until I found out only need to change my variables from 'isLiked' to 'isliked'...spent 2 days intensive reading and trying different ways to solve the problem, i think this should be highlight in tutorials / blog posts for beginners