scope概念
scope
(作用域)是視圖和控制器之間的橋梁,scope
本身是一個(gè)對(duì)象,有方法和屬性。scope
可以應(yīng)用在視圖和控制器上。
scope簡(jiǎn)單示例
<!DOCTYPE html><html ng-app="plunker"><head> <meta charset="utf-8" /> <title>AngularJS Scope Demo</title> <script> document.write('<base href="' + document.location + '" />'); </script> <link rel="stylesheet" href="style.css" /> <script data-require="angular.js@1.5.x" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.10/angular.min.js" data-semver="1.5.10"></script> <script src="app.js"></script></head><body ng-controller="Main