Controller

M ng-model model数据
V ng-bind {{}} 表现
C 核心


模块化:
1.初衷-- 重用

模块:
1.写模块
angular.module("name",[依赖])

2.用模块
ng-app = “name”


Controller
放核心、大段代码
controller 是属于某一个module
angular.module();
ng-app=

image.png

示例:

<!DOCTYPE html>
<html ng-app="test">
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="../angular.min.js"></script>
    <script>
        //1. 写模块
        let mod = angular.module('test',[]);

        //2.写controller
        mod.controller('controll1',function(){
            //代码
        })
    </script>
</head>
<body ng-controller="controll1">

</body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容