After working with Angular 1.5.6 components, I came across a peculiar discovery. I have a component named scale which I call using the following syntax:
<scale x-scale="xScale"></scale>
In my controller, I set:
$scope.xScale = 'lin'.
Here's how I defined my component:
angular
.module('myapp')
.component('scale', {
templateUrl: 'analyse/components/scales/scale.tpl.html',
controller: function(){
console.log('in controller and this is ', this);
},
bindings: {
xScale: '='
},
});
Surprisingly, when checking the console log, it showed undefined.
However, by simply changing x-scale
to r-scale
in the template and updating xScale
in the binding to rScale
, everything worked perfectly. Strangely enough, substituting the letter x with any other also made it work flawlessly. What could be causing this behavior?