发表于: 2017-05-24 23:22:36

1 975


今天完成的事情:

学习angular基础。


明天计划的事情:

开始task6。

边做任务边学习,搭建ngRoute。


遇到的问题:

angular到后面越来越难了,看着有些晕。



收获:

1,过滤器:使用一个管道字符(|)添加到表达式和指令中。


2,$http请求:

var app = angular.module('myApp', []);
app.controller('Ctrl', function($scope, $http) {
   $http.get("url地址").then(
       function (response) {
           代码
       });
});


3.制作select下拉框:

a,ng-repeat重复option,其值为字符串。

b,在select标签中使用ng-options指令,其值为对象。


4,ng-disabled,ng-show,ng-hide,其值为布尔值,若为true,则指令生效。


5,表单验证:

<span ng-show="email.$error.required">邮箱是必须的。</span>
<span ng-show="email.$error.email">非法的邮箱。</span>

email是表单的name值,$error.required是其属性,表示未填写错误。


6,使用ng-include直接引入代码:

<div ng-include="'sites.html'"></div>



返回列表 返回列表
评论

    分享到