0

I have very big form (~500 controls) and want to integrate AngularJS on it. I have one problem, when I'm setting ng-model property it resets my value property.

Is there any way to automatically set model values from input values properties (textareas and selects), without messing with controller code?

1 Answer 1

1

You can use "ng-init"

<input ng-model="data.instructions" ng-init="data.instructions='bla bla'">

But still, the recommended way is using a controller.

Hope it helps.

Sign up to request clarification or add additional context in comments.

5 Comments

it doesn't work for this.value e.g. ng-init="model_name=this.value"
From where the initial value comes from? server side injection? or jquery/js element setter?
From server side. I have really complicated form and trying to find easy way to integrate angualar without changing form logic.
So inject it to the part in the example where I've put "bla bla" instead of the value...
It's hard to implement in my code. I'm looking rather to some configuration variable. Your way is ok but for me it'll be easier to do it controller. But thanks for response I didn't know about ng-init

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.