考虑以下:
.state('manager.staffList', {url:'^/staff?alpha', templateUrl: 'views/staff.list.html', data:{activeMenu: 'staff'}, controller: 'staffListCtrl'})
.state('manager.staffDetail', {url:'^/staff/{id}' , templateUrl: 'views/staff.html', data:{activeMenu: 'staff'}, controller: 'staffDetailsCtrl'})
.state('manager.staffDetail.view', {url:'/view', templateUrl: 'views/staff.details.html', data:{activeMenu: 'staff'}})
.state('manager.staffDetail.view.schedule', {url:'/schedule', templateUrl:'views/staff.view.schedule.html', data:{activeMenu: 'staff'}})
.state('manager.staffDetail.view.history', {url:'/history' , templateUrl:'views/staff.view.history.html', data:{activeMenu: 'staff'}})
.state('manager.staffDetail.view.log', {url:'/log', templateUrl:'views/staff.view.log.html', data:{activeMenu: 'staff'}})
.state('manager.staffDetail.view.files', {url:'/files', templateUrl:'views/staff.view.files.html', data:{activeMenu: 'staff'}})
.state('manager.staffDetail.edit', {url:'/edit', templateUrl: 'views/staff.edit.html', data:{activeMenu: 'staff'}})
Run Code Online (Sandbox Code Playgroud)
如果我去domain.com/staff/1234/view,我如何默认为manager.staffDetail.view.schedule子状态?
我是新手sailsjs.我想知道如何以JSON的形式列出所有路线,包括蓝图和自定义路线.
使用angularjs和ui-router我可以:
A.)定义我的状态时定义自定义变量(参见下面的"数据").我目前这样做是成功的,想要确保它正确.
.state('parent', {url:'/parent', templateUrl: 'views/parent.html', abstract: true, data: {stuff: 'stuff'}})
Run Code Online (Sandbox Code Playgroud)
B.)让我的孩子继承可变数据(How?)
.state('parent.child', {url:'/child', templateUrl: 'views/parent.child.html', data: parent.data})
Run Code Online (Sandbox Code Playgroud)
?
这是我的大学模特
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
location:{
type:'string',
required:true
},
faculties:{
collection:'faculty',
via:'college'
}
}
};
Run Code Online (Sandbox Code Playgroud)
这是我的教师模型
module.exports = {
attributes: {
name:{
type:'string',
required:true
},
description:{
type:'string'
},
college:{
model:'college',
required:true
}
,
years:{
collection:'year',
via:'faculty'
}
}
};
Run Code Online (Sandbox Code Playgroud)
我的问题是我可以Faculty在college属性中添加任何值的new .如果我没有3000大学的大学,我仍然可以添加它,但是college当我列出所有院系时属性不会显示.如何防止它添加具有无效大学ID的教师?
我运行我的应用程序时出错.
应用程序错误.应用程序中发生错误,无法提供您的页面.请稍后重试.
如果您是应用程序所有者,请检查日志以获取详细信息.
Heroku日志:
May 05 08:17:00 game app/web.1: > node app.js
May 05 08:17:04 game app/web.1: error: Error: Failed to connect to MongoDB. Are you sure your configured Mongo instance is running?
May 05 08:17:04 game app/web.1: Error details:
May 05 08:17:04 game app/web.1: { [MongoError: connect ECONNREFUSED] name: 'MongoError', message: 'connect ECONNREFUSED' }
May 05 08:17:04 game app/web.1: at _createError (/app/node_modules/sails-mongo/lib/adapter.js:101:23)
May 05 08:17:04 game app/web.1: at /app/node_modules/sails-mongo/lib/adapter.js:104:13
May 05 08:17:04 game app/web.1: at /app/node_modules/sails-mongo/lib/connection.js:25:20
May 05 08:17:04 …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular 2和Ngrx以及Angular Material.是否所有UI更改(如下拉列表或对话框)应该存储在哪里?
例如:
<button md-button [mdMenuTriggerFor]="menu">Menu</button>
<md-menu #menu="mdMenu">
<button md-menu-item>Item 1</button>
<button md-menu-item>Item 2</button>
</md-menu>
Run Code Online (Sandbox Code Playgroud)
我应该支持商店下拉吗?
下一个例子:
<md-sidenav-container class="example-container">
<md-sidenav #sidenav class="example-sidenav">
Jolly good!
</md-sidenav>
<div class="example-sidenav-content">
<button type="button" md-button (click)="sidenav.open()">
Open sidenav
</button>
</div>
</md-sidenav-container>
Run Code Online (Sandbox Code Playgroud)
我可以使用open方法吗?也许我应该创建组件,将partnav包装在仅在输入上运行的组件中Input() open;?
sails.js ×4
javascript ×3
node.js ×3
angularjs ×2
angular ×1
angular-ui ×1
database ×1
heroku ×1
mlab ×1
ngrx ×1
sails-mongo ×1
waterline ×1