Kylo UI - 创建新的打字稿模块
Kylo UI - Create new typescript module
我对使用 Kylo 和 UI 结构的方式有疑问。
根据网站 http://kylo.readthedocs.io/en/v0.8.3/developer-guides/KyloDeveloperGuide.html?highlight=angular2 它说:
Most of the Kylo UI depends on AngularJS and AngularJS Material but a few parts have been upgraded to Angular 2 and Covalent. New plugins should be written in Typescript and use Angular 2 for future compatibility.
说新插件应该用angular2和typescript写,但是所有的例子和核心组件都是用AngularJS写的。
一个例子是这个:https://github.com/Teradata/kylo/tree/master/samples/plugins/example-module/example-module-ui
我想知道该模块的 Typescript 和 Angular2 替代方案,包括路由,是否有实际示例?
我已经测试过 Angular 2 如果将代码直接添加到 kylo-ui-app 项目中确实有效,但我认为 Kylo 的插件系统不支持 Angular 2 现在。
与标准 Angular 2 的唯一区别是 Kylo 使用 UI-Router 而不是 Angular Router,但语法非常相似。根据记忆,我认为这些是我使用的步骤:
1) 添加新路由到routes.js:
{
name: 'contacts.**',
url: '/contacts',
loadChildren: './contacts/contacts.module#ContactsModule'
}
2) 将子状态添加到您的模块中:
@NgModule({
imports: [ UIRouterModule.forChild({ states: CONTACTS_STATES }), /* ... and any other modules */ ],
declarations: [ ContactComponent, /* ... and any other components */ ],
providers: [ ContactsDataService ],
})
export class ContactsModule { }
3) 每个州的组件应在 views.content:
下指定
{
name: 'contacts',
url: '/contacts',
views: {
"content": {
component: ContactsComponent,
}
}
}
我对使用 Kylo 和 UI 结构的方式有疑问。
根据网站 http://kylo.readthedocs.io/en/v0.8.3/developer-guides/KyloDeveloperGuide.html?highlight=angular2 它说:
Most of the Kylo UI depends on AngularJS and AngularJS Material but a few parts have been upgraded to Angular 2 and Covalent. New plugins should be written in Typescript and use Angular 2 for future compatibility.
说新插件应该用angular2和typescript写,但是所有的例子和核心组件都是用AngularJS写的。
一个例子是这个:https://github.com/Teradata/kylo/tree/master/samples/plugins/example-module/example-module-ui
我想知道该模块的 Typescript 和 Angular2 替代方案,包括路由,是否有实际示例?
我已经测试过 Angular 2 如果将代码直接添加到 kylo-ui-app 项目中确实有效,但我认为 Kylo 的插件系统不支持 Angular 2 现在。
与标准 Angular 2 的唯一区别是 Kylo 使用 UI-Router 而不是 Angular Router,但语法非常相似。根据记忆,我认为这些是我使用的步骤:
1) 添加新路由到routes.js:
{
name: 'contacts.**',
url: '/contacts',
loadChildren: './contacts/contacts.module#ContactsModule'
}
2) 将子状态添加到您的模块中:
@NgModule({
imports: [ UIRouterModule.forChild({ states: CONTACTS_STATES }), /* ... and any other modules */ ],
declarations: [ ContactComponent, /* ... and any other components */ ],
providers: [ ContactsDataService ],
})
export class ContactsModule { }
3) 每个州的组件应在 views.content:
下指定{
name: 'contacts',
url: '/contacts',
views: {
"content": {
component: ContactsComponent,
}
}
}