0
我有一個項目控制器和用戶控制器可以應用它。所以我創建應用控制器來做到這一點,但問題是,我有從那裏我項目瀏覽頁面項目ID到我的應用控制器的應用方法。嵌套控制器ng-click角js
我的頁面
<div class="container_12" ng-controller="ItemCtrl" ng-init="profile()">
<div class="gallery" >
<ul class="unstyled">
<h1>{{item.name}}</h1>
<br>
<ul>
<li>About: {{item.description}}</li>
</ul>
</ul>
<br>
<div ng-controller="ApplyCtrl">
<button ng-click="apply(item._id)">Show Interest</button>
</div>
</div>
</div>
所以我想嵌套ng-controller
,因爲我想要的商品ID通過,但因爲我這個控制檯顯示錯誤。
Error: [ng:areq] http://errors.angularjs.org/1.4.8/ng/areq?p0=ApplyCtrl&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at http://localhost:8080/vendor/angular/angular.min.js:6:416
at qb (http://localhost:8080/vendor/angular/angular.min.js:22:131)
at Qa (http://localhost:8080/vendor/angular/angular.min.js:22:218)
at http://localhost:8080/vendor/angular/angular.min.js:80:210
at w (http://localhost:8080/vendor/angular/angular.min.js:60:177)
at D (http://localhost:8080/vendor/angular/angular.min.js:61:30)
at g (http://localhost:8080/vendor/angular/angular.min.js:55:105)
at g (http://localhost:8080/vendor/angular/angular.min.js:55:122)
at D (http://localhost:8080/vendor/angular/angular.min.js:62:134)(anonymous function) @ angular.js:12520(anonymous function) @ angular.js:9292r.$apply @ angular.js:16157(anonymous function) @ angular.js:1679e @ angular.js:4523c @ angular.js:1677yc @ angular.js:1697Zd @ angular.js:1591(anonymous function) @ angular.js:29013c @ jquery.js:3p.fireWith @ jquery.js:3x.extend.ready @ jquery.js:3q @ jquery.js:3
有沒有什麼辦法可以做到這一點?