Hello everyone, I am going to share the steps of using angularjs in MVC V4.0+, The steps as given bellows.
In the 1st step, Need to add the angularjs library URL on the page.
In the 1st step, Need to add the angularjs library URL on the page.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.0/angular.min.js"></script>
In the 2nd step, Need to add the basic angularjs attribute which are give below.
- ng-app,
- ng-model and
- ng-controller etc.
var app =
angular.module(myApp, []);
app
.controller('myController', ['$scope', function ($scope) {
$scope.anything = [];
}]);
</script>
The
example as given below.
<div ng-app="myApp">
<div class="jumbotron">
<h1><a href="www.code-sample.com">www.code-sample.com</a></h1>
</div>
<div class="row">
<div class="col-md-12">
<div>
<label>Filter Text</label>
<input type="text" ng-model="filterText" class="input-text" placeholder="Enter
text">
<hr>
<h1>Hello {{filterText}}!</h1>
</div>
<p>
</p>
<p><a class="btn btn-default" href="http://www.code-sample.com/2014/05/angularjs-interview-questions-and.html" target="_blank">Learn
more »</a></p>
</div>
</div>
</div>