run angular Js ng-submit locally in notepad

Hi friends in this post I am sharing how to run ng-submit .Just link the angular.min.js correct and create a html file and do the procedures given below.


angularjs-ng-submit

Copy and paste the following code in the html file,

<html ng-app="submitExample">
<head>
  <meta charset="UTF-8">
  <title>Example - example-example77-production</title>
 
  <script src="file:///C:/Users/TOSHIBA/Desktop/img/angular/angular.min.js"></script>
   
 
</head>
<body >
<form ng-submit="submit()" ng-controller="ExampleController">

  Enter text and hit enter:
  <input type="text" ng-model="text" name="text" />
  <input type="submit" id="submit" value="Submit" />
  <pre>list={{list}}</pre>
</form>
<script>
  angular.module('submitExample', [])
    .controller('ExampleController',
    ['$scope', function($scope){$scope.list = [];$scope.text = 'hello';$scope.submit = function()
    {if ($scope.text) { $scope.list.push(this.text); $scope.text = '';}  };}]
    );
</script>
</body>
</html>
Most of them will not get the output, if the yellow highlighted text is not placed.So be sure to you have add this line.
Output:

angula-js-ng-submit-example
Print Friendly and PDF
SHARE

About me

Hi. I am interested in blogging.And sometimes play with webdesign,web development,domain sale,designing logo and more.

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment