}])
</script>
</body>
</html>
06 在控制器里面定义所需要的数据与内容, 代码如下:
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href=https://vvvtt.com/article/"node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body ng-app="ng-controller">
<script src=https://vvvtt.com/article/"node_modules/bootstrap/dist/js/bootstrap.min.js">
<script src=https://vvvtt.com/article/"node_modules/angular/angular.min.js">
<script>
var myapp =augular.module('myapp',[])//定义一个模块
myapp.controller=("myctrl",['scope',function (scope) {
scope.articelelist=[
{'title':'新闻资讯','content':'新闻内容显示'},
{'title':'小说连载','content':'择天记'},
{'title':'生活百家','content':'社会相关'},
{'title':'军事演练','content':'军事图片'},
{'title':'科技','content':'手机、IT'}
]
}])
</script>
</body>
</html>
07 在<body>里面定义一个响应式容器, 一个panel组, 遍历(ng-repeat)数组数据,在panel-headding显示文章标题的内容, 代码如下:
<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href=https://vvvtt.com/article/"node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body ng-controller="myctrl">
<div class="container">
<div class="panel-group">
<div class="panel panel-default" ng-repeat="artic in articeleList">
<div class="panel-heading">
<p class="panel-title">{{artic.title}}</p>
</div>
</div>
</div>
</div>
<script src=https://vvvtt.com/article/"node_modules/bootstrap/dist/js/bootstrap.min.js">
<script src=https://vvvtt.com/article/"node_modules/angular/angular.min.js">
<script>
var myapp = angular.module('myapp',[]);//定义一个模块
//定义一个控制器
myapp.controller('myctrl',['scope',function (scope) {
scope.articeleList=[
{'title':'新闻资讯','content':'新闻内容显示'},
{'title':'小说连载','content':'择天记'},
{'title':'生活百家','content':'社会相关'},
{'title':'军事演练','content':'军事图片'},
{'title':'科技','content':'手机、IT'}
];
}])
</script>
</body>
</html>
08 运行程序 。
猜你喜欢
- 上班族久坐腰痛如何来缓解?
- 教师如何让自己变得有耐心
- 苹果手机误删的照片如何恢复?
- 如何查询天天快递单号
- 手机支付宝钱包如何绑定银行卡?
- 如何解决err_connection_reset
- 注册中的商标如何申请撤销?
- 宝宝撞伤时如何紧急处理?
- 女权主义的发展历史是怎样的,我们应如何看待当代女权主义?
- 微信如何拉黑或取消拉黑
