4

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.

2 Answers 2

6

You need to enclose the function inside of curly braces

<input char-limit="{{getCharLimit()}}" />
Sign up to request clarification or add additional context in comments.

1 Comment

Oops, what a dumb mistake! Thanks, will accept the answer after 10 minutes.
1

Typically an Angular Expression must be enclosed within {{ }}

{{ expression }}

So the correct one should be : <input char-limit="{{getCharLimit()}}" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.