3
3
3ds2012-08-09 13:37:38
JavaScript
3ds, 2012-08-09 13:37:38

how to set default value for input in angularjs?

The problem is this - I need the default value in the input to be 1 and, accordingly, the value in the field below = 50
jsfiddle.net/dTfA2/
How can I do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aav, 2012-08-09
@3ds

The easiest way is to use ngInit : jsfiddle.net/andreev_artem/dTfA2/3/
But you will almost always create a controller, right? Because the value is usually initialized there: jsfiddle.net/andreev_artem/dTfA2/4/

A
Anatoly, 2012-08-09
@taliban

plnkr.co/edit/u0vaDA (to see the result, click on the eye at the top right, there is a list of files on the left, see js)
For the future, advice with fiddle =) He's great, I love him too, but he inserts his own html and body tags , and therefore many things do not work =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question