detail.html 文件中有按钮:
<div ng-controller="test.views.detail">
<div data-ng-repeat="item in details" scroll>
<button ng-click="showDetails(item)">The details</button>
detail.js 文件
angular.module('test')
.controller('test.views.detail', function($scope) {
$scope.detailsClicked = false;
$scope.showDetails = function(item){
$scope.detailsClicked = true;
}....
在 formDetail.html 代码中:
<div ng-controller="test.views.detail">
{{detailsClicked}}
<div ng-if="detailsClicked">...
最初它显示false
detailsClicked,当我单击按钮时,它转到 showDetails 函数,但值$scope.detailsClicked
永远不会更新!直截了当不确定为什么它不起作用:(