Monday, August 22, 2016

AngularJS Controller

<!doctype html>
<html lang="en" ng-app>
<head>
  <meta charset="UTF-8">
  <title>Angular Master</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body>

<div ng-controller = "MyController">
  <h1>{{author.name}}</h1>
  <p>{{ author.title + ', ' + author.company }}</p>
</div>

<script>

function MyController($scope) {
  $scope.author = {
    'name' : 'Jaydeep Gondaliya',
    'title' : 'Happy Patel',
    'company' : 'AngularJs.com'
  }
}
</script>
</body>
</html>

No comments:

Post a Comment