0

In angularJs, i have a input text box, how do i set the default value? I tried ng-init:searchText it failed.

<div ng-app="myApp">
    <div ng-controller="myController">
        <p>
            <label>username : </label>
            <input type="text" ng-model="username" name="username" id="username" ng-init:searchText="default value" />
        </p>
</div>

1 Answer 1

1

You can use ngValue directive or init it via the ng-model property on the scope

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.