Introduction:
Java Script :-
HTML :
DEMO
This article explain you to display the message using controller in AngularJS.
Description:
Below Code is used to display message using AngularJS directive.
To implement this we need to write the code like as shown below
To implement this we need to write the code like as shown below
Java Script :-
var myApp = angular.module("myApp", []);
// Creating the controller and registering with the module all done in one line.
myApp.controller("myController2", function ($scope) {
$scope.message = "Welcome AngularJS Tutorial";
});
HTML :
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Angular modules and controllers</title>
<script src="../Scripts/angular.js"></script>
<script src="../Scripts/Script.js"></script>
</head>
<body ng-controller="myController2">
<div style="width:50%;margin:auto;"><b>{{message}}</b></div>
</body>
</html>
DEMO
No comments:
Post a Comment