Build in Directives

ng-href 

ng-src

ng-disabled

ng-checked

ng-readonly

ng-selected

ng-class

ng-style

1 always use ng-href when href includes an {{expression}}

<a ng-href="{{myHref}}">click me</a>

 

ng-include

ng-switch

ng-repeat

ng-view

ng-controller

ng-if

 

ng-include 嵌入模板

<div ng-include src="'myTemplate.html'" onload="loadTest()" autoscroll="" ng-controller="testController"></div>
demo.controller("testController", function ($scope) {

        $scope.name = "Jackey";

        $scope.loadTest = function () {

            alert("load");

        };

    });

ng-switch

ng-view

ng-if 不同于ng-show或者ng-hide ,ng-if是真正的removed from dom

ng-repeat 

  $index $first $middle $last $even $odd

ng-init 初始化时加载的数据

ng-bind 虽然我们可以用{{expression}} 但是我们同时特可以用ng-bind去模仿

ng-cloak 类似ng-bind ,但是是为了防止未渲染的时候出现的那个瞬间

<p ng-cloak>{{name}}</p>

ng-bind-template 绑定复杂的expression

ng-model 绑定数据,多用于表单元素上

ng-show/ng-hide

ng-change 值改变

ng-form 

  form.name.$valid 是否有效

  form.name.$invalid 是否无效

  form.name.$pristine 是否没被修改过

  form.name.$dirty 是否被修改过

  form.name.$error 错误集合

ng-click

ng-select 

<!DOCTYPE html>



<html ng-app="selectTest">

<head>

    <title></title>

    <script src="angular.min.js" type="text/javascript"></script>

</head>

<body ng-controller="selectController">

    <select ng-model="selectted" ng-options="(city.name+'  ,机票价格:'+city.price) group by city.name  for city in cities">

        <option value="">Choose a city</option>

    </select>

    <pre>{{selectted}}</pre>

</body>

<script>

    var selectTest = angular.module("selectTest", []);

    selectTest.controller("selectController", function ($scope) {

        $scope.cities = [

        { name: "Guangzhou", price: "$1890" },

        { name: "Beijin", price: "$789" },

        { name: "Shanghai", price: "$767" }

        ];

        $scope.selectted = "";

    });

</script>

</html>

ng-submit

ng-class

ng-attr   

 

http://segmentfault.com/a/1190000000347412 (网上的一个实例教程)

你可能感兴趣的:(Directive)