2017-04-05 19 views
0

「epimss-personnel'Given以下...獲取組件選擇

@Component(
    { 
     selector: 'epimss-personnel', 
     templateUrl: './personnel.component.html', 
     styleUrls: [ './personnel.component.css' ] 
    }) 
export class PersonnelComponent implements OnInit { 
    personnel: IPersonnel = new Personnel(); 

    constructor() { 
    } 

    ngOnInit() { 
    } 
} 

...我怎樣才能得到選擇字符串 'epimss人員' 在PersonnelComponent編程?

編輯1

當我加試的建議之下,我得到以下幾點:

compiler.es5.js:14582 Uncaught Error: Unexpected value 'AppRoutingModule' imported by the module 'AppModule'. Please add a @NgModule annotation. 
    at syntaxError (compiler.es5.js:1503) [<root>] 
    at :4200/vendor.bundle.js:117324:44 [<root>] 
    at Array.forEach (<anonymous>) [<root>] 
    at CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:13953) [<root>] 
    at JitCompiler._loadModules (compiler.es5.js:25134) [<root>] 
    at JitCompiler._compileModuleAndComponents (compiler.es5.js:25093) [<root>] 
    at JitCompiler.compileModuleAsync (compiler.es5.js:25055) [<root>] 
    at PlatformRef_._bootstrapModuleWithZone (core.es5.js:4786) [<root>] 
    at PlatformRef_.bootstrapModule (core.es5.js:4772) [<root>] 
    at Object.426 (main.ts:47) [<root>] 
    at __webpack_require__ (bootstrap d227106…:52) [<root>] 
    at Object.1132 (main.bundle.js:7) [<root>] 
    at __webpack_require__ (bootstrap d227106…:52) [<root>] 
    at webpackJsonpCallback (bootstrap d227106…:23) [<root>] 

...也不會被顯示的UI。

+1

嘗試[這](http://stackoverflow.com/a/40626338/2587435) –

+0

我在使用反映的元數據在我app.module拋出了錯誤的嘗試。似乎它反射類與es5/6 polyphils發生衝突。你見過這個嗎?它具體介紹了與App模塊有關的錯誤。 –

+0

@peeskillet請參閱上述問題的編輯1。 –

回答

0
constructor(elRef:ElementRef) { 
    console.log(elRef.nativeElement.tagName); 
} 
+0

好問題,在Dart裏它只是'name'。感謝提示。似乎他們返回相同。 –