Hello guys,
Here, I am writing a blog to develop application using AngularJS. AngularJs is a framework of JavaScript such as JQuery and it's very efficient. AngularJS is a cross browser independent.
First of all, we need to add angularJS API in our html page as below :-
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
Now, Create model and controller as below :-
angular.module("myapp", [])<br>
.controller("HelloController", function($scope) {<br>
$scope.helloTo = {};<br>
$scope.helloTo.title = "AngularJS";<br>
});
In above, "myapp" is model of angularjs which is defined in html using "ng-app" attribute and "HelloController" is a controller of the model which is define in model of the html page.
Now Create index.html page and put below code for your a sample angularJS application.
<html>
<head>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
</head>
<body ng-app = "myapp">
<div ng-controller = "HelloController" >
<h2>Welcome {{helloTo.title}} to Findnerd!</h2>
</div>
<script>
angular.module("myapp", [])
.controller("HelloController", function($scope) {
$scope.helloTo = {};
$scope.helloTo.title = " Bhagwan Singh Khichar";
});
</script>
</body>
</html>
0 Comment(s)