2016-11-16 1 views
0

は簡単な質問があり、Laravel-Angleベースのプロジェクトを取り上げ、ビューで使用されるすべてのディレクティブ、コンポーネントなどにコンストラクタでこの 'ngInject'が付いていることを確認しました。それが何を見つけるか?どのように機能するのですか?ところで、テンプレートはAngularjs 1.5.8 es6で書かれています。例:laravelAngularコンポーネント 'ngInject'

class AppHeaderController{ 
    constructor($sce){ 
     'ngInject'; 

     this.$sce = $sce; 
    } 

    $onInit(){ 
     //defer iframe loading 
     let url = 'https://ghbtns.com/github-btn.html?user=jadjoubran&repo=laravel5-angular-material-starter&type=star&count=true&size=large'; 
     this.githubWidget = this.$sce.trustAsResourceUrl(url); 
    } 
} 

export const AppHeaderComponent = { 
    templateUrl: './views/app/components/app-header/app-header.component.html', 
    controller: AppHeaderController, 
    controllerAs: 'vm', 
    bindings: {} 
} 
+1

https://github.com/olov/ng-annotate – estus

+0

ありがとうございました!心から感謝する :) – MattJ

答えて

0

コメントからの回答を投稿すると、estusが私の質問に答えました。 'ngInject'の詳細については、github.com/olov/ng-annotateをご覧ください。

関連する問題