Javascript 如何在不同的布线文件中将一个视图移动到另一个视图?
我正在尝试以角度将一个视图移动到另一个视图。实际上,我能够显示第一个视图。在该视图中有一个按钮。单击按钮时,我试图转到下一页,但我在单击按钮时出错。为什么 这是我的扑克牌 存在状态。go需要状态名称Javascript 如何在不同的布线文件中将一个视图移动到另一个视图?,javascript,angularjs,angularjs-directive,angularjs-scope,angular-ui-router,Javascript,Angularjs,Angularjs Directive,Angularjs Scope,Angular Ui Router,我正在尝试以角度将一个视图移动到另一个视图。实际上,我能够显示第一个视图。在该视图中有一个按钮。单击按钮时,我试图转到下一页,但我在单击按钮时出错。为什么 这是我的扑克牌 存在状态。go需要状态名称 function firstcont($scope,$state) { $scope.clickEvent=function(){ // instead of this // $state.go('/second') // we need this
function firstcont($scope,$state) {
$scope.clickEvent=function(){
// instead of this
// $state.go('/second')
// we need this
$state.go('secondapp')
}
}
因为您的州定义为:
$stateProvider
.state('secondapp', {
url: '/second',
...
检查是否查看了布线?下面是一篇关于它的好文章:
$stateProvider
.state('secondapp', {
url: '/second',
...
Here is the plunker:-
http://plnkr.co/edit/Y6v7ZUB1biVdWgeYpqDb?p=preview"
You need to change
$state.go('/second') to $state.go('second')
And add the state
.state('second', {
url: '/second',
views: {
app: { templateUrl: 'second.html' }
},
controller:"firstcont"
})