Hi Friend if you are fresher read my first & second post of angular Js tutorial.
Today you teach about MVC Pattern in Angular Js.
Today you teach about MVC Pattern in Angular Js.
MVC Pattern
The core idea behind MVC is that you have clear separation in your code between managing its data (model), the application logic (controller), and presenting the data to the user (view).
The core idea behind MVC is that you have clear separation in your code between managing its data (model), the application logic (controller), and presenting the data to the user (view).
- Open old project.
- Add new html File name MVC.
<!DOCTYP
Ehtml>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js">
</script>
<meta charset="utf-8">
<title>MVC pattern in AngulaJS</title>
<script type="text/javascript">
var app = angular.module("app", []);
//
defining module
app.controller('Ctrl', function ($scope) {
//defining
controller
varProductsalseman = ["shiva", "shukla"]
//defining
book's authors model it also called pojo
$scope.Product = { id: 'sh05', name: 'AngularJS ebooks',
salseman: Productsalseman }
//defining
book viewmodel
});
</script>
</head>
<body ng-app="app">
<div ng-controller="Ctrl">
<table>
<tr>
<td>Product Id :</td>
<td>
<spanng-bind ="Product.id">
</span>
</td>
</tr>
<tr>
<td>Name :</td>
<td>
<spanng-bind ="Product.name">
</span>
</td>
</tr>
<tr>
<td>salseman :</td>
<td>
<spanng-bind ="Product.salseman">
</span>
</td>
</tr>
</table>
</div>
</body>
</html>
Run your website click on right side of your hello word progrom & click on view in browser.
No comments:
Post a Comment