Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Initializing the model using an Angular controller

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 392
    Comment on it

    Hi all,

    Below example will demonstrate, How to Initializing the model using an Angular controller, defined with a global function.

    <html ng-app="nameApp">
      <head>
        <meta charset="utf-8">
        <title>Angular.js Example</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
        <script>
          var nameApp = angular.module('nameApp', []);
          nameApp.controller('NameCtrl', function ($scope){
            $scope.firstName = 'Mukul';
            $scope.lastName = 'Kant';
          });
        </script>
      </head>
      <body ng-controller="NameCtrl">
        First name:<input ng-model="firstName" type="text"/>
        <br>
        Last name:<input ng-model="lastName" type="text"/>
        <br>
        Hello {{firstName}} {{lastName}}
      </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: