hi Mohsen,
You need to adapt the template to use the controller. here is an example:
<!DOCTYPE html>
<html>
<body>
<h2>AngularJS Sample Application</h2>
<div ng-app="mainApp" ng-controller="CalcController as $ctrl">
<p>Enter a number: <input type="number" ng-model="$ctrl.number" />
<button ng-click="$ctrl.square()">X<sup>2</sup></button>
<p>Result: {{$ctrl.result}}</p>
</div>
<script src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js">
</script>
<script src ="script.js"></script>
</body>
</html>
You need to name the controller
<https://docs.angularjs.org/api/ng/directive/ngController>in the template
with the AS <name> syntax, and then use it wherever you want to reference
something in your controller.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.