记录小白前端成长03
来源:互联网 发布:物联网编程技术 编辑:程序博客网 时间:2024/05/16 19:01
Angular 笔记: →作为一个前端,对于MVC框架无理由不去研究!
①html中声明指令管理边界 <html ng-app=”myApp”>
②指定位置 <div ng-controller="mytask">
③ng-modle="task" //数据绑定(实时显示)
例: <input ng-modle="task">
<p>{{task}}</p>
④ ng-click="add()"
// function firstangular($scope){ $scope.add=function(){ }}
⑤ ng-if="tasks.length>0" //根据列表数据显示或隐藏
⑥ ng-repeat="x in names"
//<ul ng-init="names=['Jani','Hege','Kai']"><li ng-repeat="x in names">{{x}}</li>
⑦ 自定义指令 <flyFast></flyFast> //var app=angular.module();
app.directive("flyFast",function(){
return {
template:"<h1>自定义指令</h1>"
}
})
**************************刚开始有点乱************************
这里附上一些代码
<!DOCTYPE html><html lang="en" ng-app="todoList"><head> <meta charset="UTF-8"> <title>angular-demo1</title> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"></head><body ng-controller="TaskCtrl"> <div class="input-group" ng-init="firstName=John;quanity=3;count=8"> <p><input type="text " ng-model="firstName "></p> <p>你输入的为:{{firstName}}</p><input ng-model="task " type="text" class="form-control"><span class="input-group-btn "><button class="btn btn-default " ng-click="add() ">提交</button></span> <h4 ng-hide="tasks.length==0 ">任务列表</h4> <ul class=" "> <li ng-repeat="item in tasks track by $index " class="list-group-item ">{{item}} <a ng-click="tasks.splice($index,1) ">删除</a> </li> </ul> <p>质量:<input type="number" ng-model="quanity"></p> <p>数量:<input type="number" ng-model="count"></p> <p>共计:{{quanity*count}}</p></div><div ng-init="names=[{name:'cai',country:'cei'},{name:'coi',country:'cto'},{name:'cop',country:'cur'}]"><ul><li ng-repeat="x in names">{{x.name+','+x.country}}</li></ul></div><div><input name="fitname" type="text" ng-model="fitName" required><input name="lastname" type="text" ng-model="lastName" required><input name="email" type="email" ng-model="email" required><button ng-click="reset()">重置</button></div><script src="js/angular.min.js"></script><script> angular.module('todoList',[]) .controller('TaskCtrl',function($scope){ $scope.task=" "; $scope.tasks=[]; $scope.add=function(){ $scope.tasks.push($scope.task); } $scope.reset=function(){ $scope.fitName="Mahesh"; $scope.lastName="Parashar"; $scope.email="MaheshParashar@yilishabai.com"; } $scope.reset(); })</script></body></html>
- 记录小白前端成长03
- 记录小白前端成长01
- 记录小白前端成长02
- 小白前端课堂
- ionic小白前端环境搭建
- 小白前端路--html和text的区别
- 小白前端之路---关于HTML文档类型的作用
- 小白前端路----CSS块级元素和行内元素
- 马上要入坑的小白前来报道
- 【成长记录】iOS小程序-加法计算器
- 【成长记录】iOS小程序图片浏览器
- 【成长记录】ios小程序-团购
- 【成长记录】iOS小程序-英雄展示
- 记录成长
- 成长记录
- 记录成长~~~
- 记录成长
- 【成长记录】iOS小程序-不会说话的汤姆猫
- Lua5.3——C API函数
- Effective Object-c 2.0 读书笔记
- grails部署开发
- 安卓实战中防止Button的频繁点击多次执行点击事件和点击切换文字
- RedHat Linux 手动设置IP及传送文件到远程主机
- 记录小白前端成长03
- “区块链”将重新定义人类生活,你会看懂么?
- leetcode 262. Trips and Users
- 运算符重载
- ""和null的区别
- 小记——内存映射
- hdu5722Jewelry
- strlen递归实现
- iOS9 HTTP 不能正常使用的解决办法