0

I want to set the size of the input tag in my html based on the size of the ng-model value.

I tried this

<span>Node Path:  
<input for="nodeName" type="text" ng-model="nodePath" size="{{nodePath.length()}}"ng-disabled="true">
</span>

but it throws this exception

Error: [$interpolate:interr] Can't interpolate: {{nodePath.length()}}
TypeError: v2.length is not a function

How can I achieve this ?

2
  • 1
    string.length is a property, not a function. Remove the () in {{nodePath.length()}} ? Commented Aug 12, 2015 at 13:23
  • 1
    Have you tried {{ nodePath.length }} ? Commented Aug 12, 2015 at 13:29

1 Answer 1

1

The error is pretty clear: length is not a function.

Replace

{{notePath.length()}}

with

{{notePath.length}}
Sign up to request clarification or add additional context in comments.

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.