Intro to angular js
Now let’s discuss some basics of angular js. Angluar extends HTML with its own directives. Also angular makes your code compact and smaller in volume. For example, form validation with jquery and angluar are different if we will consider code volume. Jquery gives your functions and you describe validation process. Angular already has got mechanism of validation and activate it when user initializes this event. You need not to describe logics of validation.
Next feature is directives. We considered two:
ng-app – initializes angular app.
ng-model – model designation.
It is important to notice, angular uses MVC pattern (Model-View-Controller). Model in angular is data. Controller is “link” between model and view. It realizes business logics.
In this lesson we created skeleton of our future app. We used sport application, which we had written in php and mysql.
In next lessons we will continue to build it with angular.
Code lesson
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<table class="table table-hover">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
</script>
</body>
</html>
0 Comments