HI,
In angular js we are able to create n number of controllers
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="UTF-8">
<title>Anuglar js Controller Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
</head>
<body>
<div ng-controller="myController">
Display the username with controller example in angular,<br/>
The username :
</div>
</body>
<script>
var app = angular.module('myapp', []);
app.controller('myController',function($scope){
$scope.name = "Manikanta";
})
</script>
</html>
In angular js we are able to create n number of controllers
Controller Basics
- The Controller directive in html for angular js is (ng-controller)
- Controller will be a function that angular invokes
- Controller takes $scope as its parameter.
- Angular JS Controllers control the data of AngularJS Applications.
- Angular JS Controllers are regular JavaScript Objects..
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="UTF-8">
<title>Anuglar js Controller Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
</head>
<body>
<div ng-controller="myController">
Display the username with controller example in angular,<br/>
The username :
{{name} }
</div>
</body>
<script>
var app = angular.module('myapp', []);
app.controller('myController',function($scope){
$scope.name = "Manikanta";
})
</script>
</html>
Output
Display the username with controller example in angular,
The username : {{name}}
The username : {{name}}
0 comments:
Post a Comment