How To Register A Controller
To register a controller to a module, outset you have to create an angularjs module using athwart object module method() and create a controller past setting up the initial state of the telescopic object in JavaScript office. You can register a controller with the module object every bit shown below.
< script blazon ="text/javascript" src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.v.8/angular.min.js"></ script >< script type ="text/javascript">
var myModule = angular.module( "Module1" , []);
var Mycontroller = function ($telescopic) {
$telescopic.msg = "Welcome to Infinetsoft" ;
}
myModule.controller( "mycontroller" ,Mycontroller);
</ script >
view:
< trunk ng-app ="Module1">< div ng-controller ="mycontroller">
{{ msg }}
</ div >
</ torso >
Description:
Equally Here, myModule and Mycontroller are the proper noun of the module and controller. We registered a Mycontroller into myModule past using a controller belongings of angularjs.
Output:
Source: https://www.infinetsoft.com/Post/How-to-register-controller-into-model-in-angularjs/1382
Posted by: shawstookins.blogspot.com
0 Response to "How To Register A Controller"
Post a Comment