My markup was:
<input char-limit="10" />
Then I needed to set the attribute value from controller, so I did this:
<input char-limit="{{charLimit}}" />
And in controller:
$scope.charLimit = <my value>;
Now, instead of using the model value directly; I need to use the function to return the value. So I did:
<input char-limit="getCharLimit()" />
And in controller:
$scope.getCharLimit= function(){
return <my value>;
}
But the value is not reflected in the markup.
asked Aug 7, 2015 at 6:48
benjamin54
1,3004 gold badges28 silver badges50 bronze badges
2 Answers 2
You need to enclose the function inside of curly braces
<input char-limit="{{getCharLimit()}}" />
answered Aug 7, 2015 at 6:51
Bidhan
10.7k3 gold badges42 silver badges51 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
benjamin54
Oops, what a dumb mistake! Thanks, will accept the answer after 10 minutes.
Typically an Angular Expression must be enclosed within {{ }}
{{ expression }}
So the correct one should be : <input char-limit="{{getCharLimit()}}" />
answered Aug 7, 2015 at 7:01
Dinesh Chitlangia
5886 silver badges21 bronze badges
Comments
lang-js