Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在不同的布线文件中将一个视图移动到另一个视图?_Javascript_Angularjs_Angularjs Directive_Angularjs Scope_Angular Ui Router - Fatal编程技术网

Javascript 如何在不同的布线文件中将一个视图移动到另一个视图?

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

我正在尝试以角度将一个视图移动到另一个视图。实际上,我能够显示第一个视图。在该视图中有一个按钮。单击按钮时,我试图转到下一页,但我在单击按钮时出错。为什么

这是我的扑克牌

存在状态。go需要状态名称

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"
            })