S
S
sergey19892016-01-21 19:29:30
JavaScript
sergey1989, 2016-01-21 19:29:30

The simplest question on Angular?

Hello. Started learning Angular. It is not possible to output the value of the input to the res expression through the controller. There is no output. And How can I add the value of ng-model digits from different inputs?

<script>
var moduleCalc=angular.module('moduleCalc', []);


moduleCalc.controller('calcCtrl', function($scope){
  
  
  
  $scope.res=$scope.first;
  
});
  </script>

</head>
<body ng-controller="calcCtrl">
  <input type="text" name="ss" class="form-control" value="ddd" pattern="" title="" ng-model="first">
  
  {{res}}
</body>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
coderisimo, 2016-01-22
@sergey1989

But it works)) Do you understand why? :
controller:

var TestApp = angular.module("TestApp", []);
function TestCtrl($scope) {
  $scope.t1 = {name:'vasya'};
  $scope.t2 = $scope.t1;
}

markup piece:
t1-   {{t1.name}}<br><br>
<input type='text' ng-model='t1.name'><br>
 t2-   {{t2.name}}

PS and add like this {{t1.name + t2.name }} - just substitute the numbers

S
Sergey, 2016-01-21
Protko @Fesor

https://github.com/johnpapa/angular-styleguide#sty...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question