정수 초기화

<div ng-app="" ng-init="quantity=1;cost=5">

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

</div>




<div ng-app="" ng-init="quantity=1;cost=5">

<p>Total in dollar: <span ng-bind="quantity * cost"></span></p>

</div>


스트링 값 초기화

<div ng-app="" ng-init="firstName='John';lastName='Doe'">

<p>The name is {{ firstName + " " + lastName }}</p>

</div>



<div ng-app="" ng-init="firstName='John';lastName='Doe'">

<p>The name is <span ng-bind="firstName + ' ' + lastName"></span></p>

</div>




객체형태로초기화 

<div ng-app="" ng-init="person={firstName:'John',lastName:'Doe'}">


<p>The name is {{ person.lastName }}</p>

</div>



<div ng-app="" ng-init="person={firstName:'John',lastName:'Doe'}">

<p>The name is <span ng-bind="person.lastName"></span></p>

</div>



배열로 초기화하는 방법

div ng-app="" ng-init="points=[1,15,19,2,40]">


<p>The third result is {{ points[2] }}</p>

</div>

'JAVA > AngularJS' 카테고리의 다른 글

AngularJS  (0) 2016.01.28
AngularJS 흔히 알고있는 Print와 같은 {{}}  (0) 2016.01.28
AngularJS 변수초기화해주는 NG-INIT  (0) 2016.01.28
AngularJS 시작  (0) 2016.01.28
블로그 이미지

왕왕왕왕

,