How do I get an input value into Angular's $scope?

前端 未结 2 1593
无人及你
无人及你 2021-01-12 00:47

I\'m new to Angular, and I am trying to do something really basic. Here is a part of a view (all angular files are added elsewhere) :

 
2条回答
  •  一整个雨季
    2021-01-12 01:42

    If you really need it in array, just do this in your controller:

    $scope.data = [0];

    and in HTML do

    It will fill that array value automaticaly as you type something in INPUT, id will be always at first position in array.

    Or you can handle it with object In controller: $scope.data = {};

    in HTML

提交回复
热议问题