Angular Js

Client-side MVC framework written in Javascript.

Hello World

<!doctype html>
<html>
    <title>Example Hello World</title>
    <body ng-app ng-init="name = 'World'">
        <h1>Hello, {{ name }}</h1>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/angular.js"></script>
    </body>
</html>
  • ng-app
  • ng-init
  • {{}}

Two Way Data Binding

<!doctype html>
<html>
    <title>Example Hello World</title>
    <body ng-app ng-init="name = 'World'">
        Say hello to: <input type="text" ng-model="name"/>
        <h1>Hello, {{ name }}</h1>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/angular.js"></script>
    </body>
</html>
  • ng-model
  • no refresh

MVC

  • Model
  • View
  • Controller

Controller

  • Initialize scope object (init model values, augmenting $scope ui-spesif behaviour(function))
  • $scope, object in AngularJs to expose domain model. By assigning properties.

Angular Js

By Budi Wahyu Herlen Adita