There are three main basic directives that every Angular developer must know
- ng-app
Initialize an AngularJs application
- ng-init
Initialize application data
- ng-model
Binds the value of HTML controls such as input, select, textarea to application data.
<!DOCTYPE html>
<html>
<head>
<script src="scripts/angular.min.js"></script>
</head>
<body ng-app="">
<div ng-init="firstName='name'">
<p>Name: <input type="text" ng-model="firstName"></p>
<p>Welcome : {{ firstName }}</p>
</div>
</body>
</html>
Here is a live demo. try it
Live Demo
Name:
Welcome : {{ firstName }}
Welcome : {{ firstName }}
No comments:
Post a Comment