我在我的角度js项目中嵌套了抽象视图
当我移动到嵌套的抽象视图时,我得到了SELECT [Hitopathology Table].HospNo, [Hitopathology Table].RecNo, [Hitopathology Table].Name, [Hitopathology Table].Age, [Hitopathology Table].Sex, [Hitopathology Table].Diagnosis, [Hitopathology Table].ReportDate, [Drs List].Surname, [Hospital List].[Hospital Name], [Hitopathology Table].Comments
FROM [Hospital List]
INNER JOIN ([Drs List]
INNER JOIN [Hitopathology Table]
ON [Drs List].DrNo = [Hitopathology Table].DrNo)
ON [Hospital List].HospNo = [Hitopathology Table].HospNo;
我的Error : Cannot transition to abstract state 'main.middle'
代码如下:
html
当我点击<!DOCTYPE html>
<html ng-app="nesting">
<head>
<script data-require="angular.js@*" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
<script data-require="ui-router@*" data-semver="0.2.10" src="https://rawgit.com/angular-ui/ui-router/0.2.10/release/angular-ui-router.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="testController">
href:
<br />
<a href="#/alpha">#/alpha</a>
<a href="#/beta">#/beta</a>
<a href="#/gama">#/gama</a>
<button ng-click="moveToMiddle()">move to middle</button>
<br />
ui-sref:
<br />
<a ui-sref="main.middle.alpha">main.middle.alpha</a>
<a ui-sref="main.middle.beta">main.middle.beta</a>
<a ui-sref="main.middle.gama">main.middle.gama</a>
<hr />
<div ui-view=""></div>
<script>
'use strict';
var $urlRouterProviderRef = null;
var $stateProviderRef = null;
var app = angular.module('nesting', [
'ui.router'
]);
app.config(function( $urlRouterProvider, $stateProvider) {
$urlRouterProvider.otherwise('/alpha');
$stateProvider
.state('main', {
url: "",
abstract: true,
template: '<div><h3>Main</h3><div ui-view=""></div></div>',
})
.state('main.middle', {
url: "",
abstract: true,
template: '<div><h4>Middle</h4><div ui-view=""></div></div>',
})
.state('main.middle.alpha', {
url: "/alpha",
template: '<div><h5>The leaf: {{state.name}}</h5></div>',
controller: function ($scope, $state){
$scope.state = $state.current;
},
})
.state('main.middle.beta', {
url: "/beta",
template: '<div><h5>The leaf: {{state.name}}</h5></div>',
controller: function ($scope, $state){
$scope.state = $state.current;
},
})
.state('main.middle.gama', {
url: "/gama",
template: '<div><h5>The leaf: {{state.name}}</h5></div>',
controller: function ($scope, $state){
$scope.state = $state.current;
},
})
;
});
app.controller('testController', function ($scope, $state) {
$scope.moveToMiddle = function () {
$state.go('main.middle');
}
})
</script>
</body>
</html>
按钮时出现错误。
如何转移到抽象视图?
我提到了Query Hive Metadata Store for table metadata,但在我的案例中没有用。
答案 0 :(得分:1)
你永远不会去到抽象状态。来自docs:
抽象状态可以具有子状态但不能自行激活。一个&#39;摘要&#39;国家只是一个无法转变的国家。当其中一个后代被激活时,它会被隐式激活。
如果您将main.middle.alpha
,main.middle.beta
和main.middle.gama
定义为不抽象,则可以转换为这些。
答案 1 :(得分:0)
如angualr docs中所述
抽象状态可以具有子状态但无法激活 本身。 “抽象”状态只是一种不可能的状态 过渡到。当其中一个时,它会被隐式激活 后代被激活。
app.controller('testController', function ($scope, $state) {
$scope.moveToMiddle = function () {
$state.go('main.middle.alpha');
}
由于抽象状态无法实例化且无法查看。如果您想要访问,请删除abstract
行