Angularjs complex operation case based on MVC
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "UTF-8">5 <title>angularjs Complex operation case based on MVC</title>6 <Scripttype= "Text/javascript"src=".. /js/angular.min.js "></Script>7 </Head>8 <Body>9 <!--ng-app= "MyApp" defines a module -Ten <DivNg-app= "MyApp"Ng-controller= "Myctrl"> One <Div> A <!--Ng-model Model Action - - <inputtype= "text"name= "Name"Ng-model= "Name" /> - <!--provide a button - the <inputtype= "button"value= "Empty"Ng-click= "Clearval ()" /> - </Div> - <Div> - <!--{{}} is equivalent to Ng-bind for data display - + Hello,{{name}} - </Div> + </Div> A </Body> at <Scripttype= "Text/javascript"> - //Initialize the MyApp module - varMyApp=Angular.module ("MyApp",[]); - //define the controller for the module - //Dependency Injection, $scope scope object, manipulating the current scope view - Myapp.controller ("Myctrl",["$scope",function($scope) { in //Initialize the model to assign values - $scope. Name= "you and me, he learns."; to //provide Clearval Click events at Scope + $scope. Clearval= function(){ - //model is set to empty the $scope. Name= "";//empty the contents of the input box * } $ }]);Panax Notoginseng </Script> - </HTML>
Angularjs complex operation case based on MVC