agular test

by oktaviardi pratama

HTML

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<!--
<div ng-app="" ng-init="quantity=1;cost=5">
<p>Total in dollar: <span ng-bind="quantity * cost"></span></p>
</div>
-->

<!--
using ng-bind
<div ng-app="" ng-init="firstName='John';lastName='Doe'">
<p>The name is <span ng-bind="firstName + ' ' + lastName"></span></p>
</div>
-->

<!--
using object
<div ng-app="" ng-init="person={firstName:'okta',lastName:'pratama'}">
<p>The name is {{ person.lastName }}</p>
</div>
-->

<!--using array
<div ng-app="" ng-init="points=[1,15,19,2,40]">
<p>The third result is {{ points[2] }}</p>
</div>
-->

<!-- using ng-model
<div ng-app="" ng-init="firstName='John'">
    
<p>Input something in the input box:</p>
<p>Name: <input type="text" ng-model="firstName"></p>
<p>You wrote: {{ firstName }}</p>

</div>
-->

<!--
 <div data-ng-app="" data-ng-init="quantity=1;price=5">

<h2>Cost Calculator</h2>

Quantity: <input type="number" ng-model="quantity">
Price: <input type="number" ng-model="price">

<p><b>Total in dollar:</b> {{quantity * price}}</p>

</div>
-->
    
<!--data-ng-repeat 
<div data-ng-app="" data-ng-init="names=['Jani','Hege','Kai']">
  <p>Looping with ng-repeat:</p>
  <ul>
    <li data-ng-repeat="x in names" class=" {{ x }}">
      {{ x }}
    </li>
  </ul>
</div>
-->    


<!-- 
ng-repeat directive used on an array

<div ng-app="" ng-init="namaMobil=[
{nama:'honda',country:'2010'},
{nama:'toyota',country:'2004'},
{nama:'suzuki',country:'2000'}]">

<p>Looping with objects:</p>
<ul>
  <li ng-repeat="x in namaMobil">
  {{ x.nama + ', ' + x.country }}</li>
</ul>

</div>
-->


<!-- 
<div ng-app="myApp" ng-controller="personCtrl">

First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{fullName()}}

</div>

<script>
var app = angular.module('myApp', []);
app.controller('personCtrl', function($scope) {
    $scope.firstName = "John";
    $scope.lastName =...

JavaScript

angular.module('myApp',[]).controller('carControl',function($scope){
	$scope.dataSaya=[
        {merek:'toyota',tahun:'2003'},
        {merek:'honda',tahun:'2005'},
        {merek:'nissan',tahun:'2010'}
        
    ];
});