AngularJS入门笔记01

AngularJS 表达式

使用ng-repeat 来循环数组
<div ng-app="" ng-init="names=['Jani','Hege','Kai']">
    <ul>
        <li ng-repeat="x in names">
            {{ x }}
        </li>
    </ul>
</div>

 

<div ng-app="" ng-init="names=[
{name:'Jani',country:'Norway'
},
{name:'Hege',country:'Sweden'},
{name:'Kai',country:'Denmark'}
];countrys=[
{name:'1',country:'a'},
{name:'2',country:'b'},
{name:'3',country:'c'}
]">
    <p>循环对象:</p>
    <ul>
        <li ng-repeat="x in names">
            {{x.name + ',' + x.country}}
        </li>

        <li ng-repeat="y in countrys">
            {{y.name + ',' + y.country}}
        </li>
    </ul>
</div>

 

posted @ 2017-06-16 14:36  kailzhou  阅读(142)  评论(0编辑  收藏  举报