i've got a bug with ionic2.
the context:
I make a empty project with ionic start myProject --v2.
I've import my entity {User} in about.ts and i make a new User() in code.
but User use a decorator "@myDeco."
the compilation send no error but ionic does:
Cannot resolve all parameters for 'Parser'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Parser' is decorated with Injectable.
or
Unexpected value 'HomePage' declared by the module 'AppModule'
if i comment @myDeco it's works well. (of course i've installed reflect-metadata with npm install)
tree:
src/bdd/entity/User.ts
src/bdd/reflect/myreflect.ts
src/pages/about/about.ts
code:
myreflect.ts
import 'reflect-metadata';
export function myDeco(target: any, key: string) : void{
var t = Reflect.getMetadata("design:type", target, key);
console.log(`${key} type: ${t.name}`);
}
User.ts
import {myDeco} from '../reflexif/myreflect'
export class User {
@myDeco
private login: string;
public setlogin(login: string) {this.login=login;}
}
About.ts
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {User} from '../../bdd/entity/User'
@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {
constructor(public navCtrl: NavController) {
let u = new User();
u.setLogin('grgr');
}
}
Thanks !
Michael.