Sunday, 23 April 2017

AngularJS-2 : Module and Controller

AngularJS-2 : Module and Controller



angular.min.js
-------------------------------------


Script.js
------------------------------------
/// <reference path="angular.min.js" />

var myAppModule = angular.module("myAppModule",[]);

var myDataController = function ($scope) {
    $scope.message = "Angular JS Tutorial";  //dummy data, in real time model will be binded to $scope
};

myAppModule.controller("myDataController", myDataController);


myHTML.html
------------------------------------
<!DOCTYPE html>
<html ng-app="myAppModule">
    <head>
        <script type="text/javascript" src="resources/js/angular.min.js"></script>
        <script type="text/javascript" src="resources/js/Script.js"></script>
    </head>
    <body ng-controller="myDataController">
   
    <div>
        {{ message }}
    </div>

    </body>
</html>








No comments:

Post a Comment

AngularJS-24 : Router

AngularJS-24 : Router https://www.youtube.com/watch?v=hThmoKA9aeU#t=427.383649 Download "angular-route.min.js"and add to p...