我很熟悉"$urlRouterProvider.otherwise('{route here}')"在Angular UI-Router中用作catch all的angular语法.
我想知道的是 - 有没有办法根据输入错误的路线时的父状态进行条件"否则"路由?
例如,假设我有以下配置:
$stateProvider
.state('core', {configuration here})
.state('core.page1', {configuration here...})
.state('dashboard', {configuration here})
.state('dashboard.page1', {configuration here})
$urlRouterProvider.otherwise('/core/page1');
Run Code Online (Sandbox Code Playgroud)
我想要发生的是,无论何时输入路线"/core/{route here}",
如果它与任何当前状态都不匹配,则路由回'/ core/page1',
并且无论何时输入路线"/dashboard/{route here}"路线返回时,与当前任何状态都不匹配"/dashboard/page1".
任何人都有这方面的经验,或者我是如何实现它的?是否有任何内置于Angular的内容允许这种行为?
提前致谢!
我是Sequelize的新手,并努力了解这个非常奇怪的ORM新世界是如何运作的.一旦我似乎无法理解的事情是Sequelizejs中".create"和".save"之间的区别.我已经用两者编写了测试函数,除了语法略有不同之外,它们似乎都做了完全相同的事情.
这是使用".save"方法
models.User.build({
username: req.body.username,
password: req.body.password,
first_name: req.body.firstName,
last_name: req.body.lastName
})
.save()
.then(function(task){
// some function...
})
.catch(function(error){
// some function...
});
Run Code Online (Sandbox Code Playgroud)
这是使用".create"方法
models.User.create({
username: req.body.username,
password: req.body.password,
first_name: req.body.firstName,
last_name: req.body.lastName
}).then(function(data) {
// some function...
});
Run Code Online (Sandbox Code Playgroud)
我在这里看不到什么?
我正在尝试将我的应用程序转移到新机器上.它完美地适用于旧机器,我一直在尝试尽可能地复制设置,但是缺少一些东西.这是我得到的错误:
Unhandled rejection SequelizeConnectionError: Handshake inactivity timeout
at Handshake._callback (/Applications/MAMP/htdocs/dashboard-server/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:63:20)
at Handshake.Sequence.end (/Applications/MAMP/htdocs/dashboard-server/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at /Applications/MAMP/htdocs/dashboard-server/node_modules/mysql/lib/protocol/Protocol.js:393:18
at Array.forEach (native)
at /Applications/MAMP/htdocs/dashboard-server/node_modules/mysql/lib/protocol/Protocol.js:392:13
at doNTCallback0 (node.js:417:9)
at process._tickCallback (node.js:346:13)
Run Code Online (Sandbox Code Playgroud)
思考?
我正在开始一个新的Ionic项目,我正在尝试使用Moment.js.然而,它正在抛出一个我正在努力弄清楚的错误.我在Ionic或Moment中没有改变任何东西,但当我尝试加载项目时,它说:
未捕获的SyntaxError:意外的保留字
然后当我查看它来自的代码时,它位于moment.js文件中.我以前多次使用过这个模块,并没有给我任何问题,但这是我的第一个离子项目.我错过了什么?

