Onsen UI 2 demo:属性不存在
Onsen UI 2 demo: property does not exist
https://github.com/OnsenUI/angular2-onsenui-kitchensink上的"hello world"示例不适合我。在输入npm start之后,我得到了以下错误:
ERROR in [default] ../angular2-onsenui-kitchensink/src/app/components/animations/animations.ts:45:20
Property 'pushPage' does not exist on type 'OnsNavigator'.
ERROR in [default] ../angular2-onsenui-kitchensink/src/app/components/animations/animations.ts:46:37
Property 'popPage' does not exist on type 'OnsNavigator'.
ERROR in [default] ../angular2-onsenui-kitchensink/src/app/components/home/home.ts:27:20
Property 'pushPage' does not exist on type 'OnsNavigator'.
ERROR in [default] ../angular2-onsenui-kitchensink/src/app/components/tabbar/tabbar.ts:23:20
Cannot find name 'ons'.
我已经将pushComponent替换为pushPage,但它没有帮助。有人有onsenui 2和AngularJS2的工作演示项目吗?
我的<<p> em> tabbar.ts :import {Component} from '@angular/core';
import {Routes, ROUTER_DIRECTIVES} from '@angular/router';
@Component({
selector: 'tabbar',
providers: [],
pipes: [],
directives: [ROUTER_DIRECTIVES],
templateUrl: 'app/components/tabbar/tabbar.html',
styleUrls: ['app/components/tabbar/tabbar.css'],
})
export class Tabbar {
tabs: Array<any>;
material: boolean;
constructor() {
this.tabs = [
{ path: '/home', label: 'Home', },
{ path: '/forms', label: 'Forms', },
{ path: '/dialogs', label: 'Dialogs', },
{ path: '/animations', label: 'Animations', },
];
this.material = ons.platform.isAndroid();
}
updateStyle(platform: string) {
this.material = platform === 'android';
}
}
我的<<p> em> animation.ts : import {Component, Inject, forwardRef} from '@angular/core';
import {ONS_DIRECTIVES, OnsNavigator} from 'angular2-onsenui';
@Component({
selector: 'ons-page',
template: `
<div class="waiting">Please wait...</div>
`,
styles: [`
.waiting {
text-align: center;
font-size: 24px;
margin: 100px auto 0;
}
`],
providers: [],
directives: [ONS_DIRECTIVES],
pipes: []
})
export class TempPage {
animations = ['none', 'fade', 'slide', 'lift'];
constructor(@Inject(forwardRef(() => OnsNavigator)) private _navigator : OnsNavigator) {
}
ngOnInit() {
}
}
@Component({
selector: 'animations',
templateUrl: 'app/components/animations/animations.html',
providers: [],
directives: [ONS_DIRECTIVES],
pipes: []
})
export class Animations {
animations = ['none', 'fade', 'slide', 'lift'];
constructor(@Inject(forwardRef(() => OnsNavigator)) private _navigator : OnsNavigator) {
}
push(animation) {
this._navigator.pushPage(TempPage, { animation });
setTimeout(() => this._navigator.popPage(), 1500);
}
ngOnInit() {
}
}
提前感谢!
问题是一个过时的AngularJS依赖。github存储库现在是最新的,问题已经解决了。
相关文章:
- 查找数组's按属性不存在于另一个数组中的对象
- 错误 TS2339:类型“{}”上不存在属性“forEach”
- Express和Typescript-Error.stack和Error.status属性不存在
- 在'用于'如果javascript中不存在对象属性,则循环
- Realm React Native-需要迁移:目标类型'字符串'不会'不存在于属性'电
- 有没有一个lodash函数可以合并两个对象并删除其中一个对象的属性(如果它们没有)'不存在于另一个中
- Javascript:当属性可能不存在时,在对象中使用OR条件
- Javascript for ..有时通过不存在的属性
- TypeScript 工厂模式说属性不存在
- 如果属性不存在,则不显示对象的数据
- Spring复选框选中的属性不存在
- 属性不存在
- 如果属性不存在,为什么它不能通过“返回一个空数组”的测试?
- 如果对象属性不存在,则创建普通变量回退的Javascript
- Onsen UI 2 demo:属性不存在
- 当Object属性不存在时触发错误
- Angular:在ng-repeat中设置一个默认值,如果某项的'属性不存在
- MeteorJS用户配置文件对象属性不存在
- Angular2属性不存在'any[]'(JSON)
- Angular2,订阅事件发射器上的属性不存在