码迷,mamicode.com
首页 > 其他好文 > 详细

angular学习的一些小笔记(中)之ng-init

时间:2016-10-24 13:25:31      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:text   min   plugin   head   test   init   表达   ext   class   

ng-init是给angular执行给定的表达式,初始化变量的值

<!DOCTYPE html>
<html>
<head>
    <meta charset=‘UTF-8‘>
    <title>ng-init</title>
    <script type="text/javascript" src=‘static/plugins/angular.min.js‘></script>
</head>
<body>
<div ng-app=‘‘ ng-init=‘myTest="hello world"‘>
    {{myTest}}
</div>
</body>
</html>

这样就初始化了myTest的值,ng-app没有设值,要是设置的话,就要js啦,要不然就得报错了

angular学习的一些小笔记(中)之ng-init

标签:text   min   plugin   head   test   init   表达   ext   class   

原文地址:http://www.cnblogs.com/lwwen/p/5992411.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!