-5
試圖將單個模型綁定到兩個控制器以同時更新。然後使用標籤顯示模型的相關值。模型未綁定angularjs控制器
的index.html
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body >
<div ng-app="" >
<input type="text" ng-model="model.msg">
<h1>{{model.msg}}</h1>
<div ng-controller="firstController">
<input type="text" ng-model="model.msg">
<h1>{{model.msg}}</h1>
</div>
<div ng-controller="secondController">
<input type="text" ng-model="model.msg">
<h1>{{model.msg}}</h1>
</div>
</div>
<script type="text/javascript" src="controller/main.js"></script>
<script type="text/javascript" src="dependancies/angular.min.js"></script>
</body>
main.js
function firstController($scope){}
function secondController($scope){}
Err。所以,*你的問題*? – Manhattan