Sunday, August 9, 2015

Angularjs For Controller


Controller

       A Controller is a javascript object, created by a standard javascript constructor.in angular, a controller is define by a javascript constructor function that is used to augment the angular scope

ng-Controller

       ng-controller is a directive to use create controller in angularjs.

Use Controller and Scope in example

       Now we will see how controller sets the initial of a $scope object

HTML CODE

<!DOCTYPE html>
<html>
     <head>
          <title>AngularJs Controller and Scope</title>
          <script src="js/angular.min,js"></script>
     </head>
     <body>
 <div ng-app="" ng-controller="angularController">
First Name:<input type="text" na-model="firstName" /><br />
Last Name: <input type="text" ng-model="lastName" /><br />
<br />
Full Name : {{firstName + "" + lastName}}
<br />
Programmer Name: {{languageName}}
 </div>
     </body>

</html>

Javascript Code

function angularController($scopr)
{
$scope.fistName = "Rehan"
$scope.lastName = "Meo"
$scope.languageName = "Javascript"

}

Video  Comming Soon




1 comment:

  1. Nice blog.That is very interesting; you are a very skilled blogger. I have shared your website in my social networks! A very nice guide.
    freelance web designers in hyderabad

    ReplyDelete

Swift Start Here