ng-init directive will be useful for initialize the application data.
syntax:
<htmltag ng-init="variablename=value">
Example:
<div ng-init="blog='aspnettutorialonline.blogspot.com'" >
Full Code:
<!DOCTYPE html>
<html>
<head>
<script src="angular.min.js"></script>
<script>
var myApp=angular.module("myModule",[])
</script>
<title></title>
</head>
<body ng-app>
<!--ng-init directive is for initialize the angular js application data. -->
<div ng-init="blog='aspnettutorialonline.blogspot.com'" >
{{blog}}
</div>
</body>
</html>
output:
aspnettutorialonline.blogspot.com
If you have any queries or suggestions, please feel free to ask in comments section.
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.