Angular4.0 項目報錯:Unexpected value xxxComponent' declared by the module 'xxxxModule'. Please add a @Pi

    最近剛剛開始學習angular 4.0,在網上找了一個小項目教程學習,然而學習的過程有點艱辛,,各類報錯,我明明就是按照博主的步驟老老實實走的呀!!話很少說,上bug-  。-學習

    Uncaught Error: Unexpected value 'ProductComponent' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.component

    剛剛報錯的時候我一臉懵逼,什麼意思呀?要加管道??而後自覺得是模塊的問題,私自寫了一個product.module.ts,然而仍是解決不了問題,反而報更多的bug,最後被逼無奈,只有百度了,,沒想到,一查竟然就查出來了!!blog

  原來是由於裝飾器@component須要緊挨着要導出的組件,沒有這個修飾符,你覺得的組件並非一個真正的組件,只是一個普通類。教程

  以前我是這樣子寫的:ip

                                      

  正確的寫法應該是這樣的:io

                         

    但願對你們有幫助!!angular

相關文章
相關標籤/搜索