我的代码中有以下设置
.config(function config($stateProvider)
$stateProvider
.state('home', {
url : '/home',
views : {
'main' : {
controller : 'HomeCtrl',
templateUrl : 'home/home.tpl.html'
}
}
})
.state('home.details', {
url : '/details',
views : {
" " : {
template : "<h1>hello</h1>",
controller : function ($scope, $http, $state) {
//do some stuff here
//does not seem to reach code in here
}
}
}
});
})
.controller('HomeCtrl', function ($scope, $http, $state) {
//on a button click do $state.go('.details');
});
Run Code Online (Sandbox Code Playgroud)
当我这样做时,单击我的按钮HomeCtrl似乎将我带到/ home/details但是在那个点上它似乎没有进入该特定路径的控制器内部.(我通过在控制器内部设置断点来查看详细信息.)我的设置有问题吗?我正在尝试做类似于网页中显示的 …
我的代码中的ng-grid有以下设置:
$scope.gridOptions = {
...
useExternalSorting : false,
}
$scope.watch('gridOptions.ngGrid.config.sortInfo', function (oldValue, newValue) {
console.log(newValue)
})
Run Code Online (Sandbox Code Playgroud)
我也试过用sortInfo : undefined和$watch(gridOptions.sortInfo).这似乎仅在网格最初加载时起作用.之后,当我点击标题列时,它似乎没有进入回调函数$watch.我尝试在回调函数中放置一个调试器来触发排序,我可以看到代码用正确的信息更新sortInfo数组,但是它似乎没有进入watch语句的回调函数.我的设置有什么不对吗?我在这里有一个类似于我正在尝试的东西.