2

以下のような、ステータスとその順番等を管理するオブジェクトを定義したいのですが、
この場合、AngularJSではどこにどのように定義するべきなのでしょうか?
サービスとして定義するべきなのでしょうか?

status = [
           { waiting  :{index:1, icon_img:'xxx1.png'} },
           { operating:{index:2, icon_img:'xxx2.png'}},
           { complate :{index:3, icon_img:'xxx3.png'}}
         ]

1 件の回答 1

1

Angular1.*系であれば、module.constantでconfigフェイズでも使用できるDIが定義できます。

DEMO

angular.element(document)
.ready(function(){
  angular.bootstrap(document,['myApp']);
});

angular.module('myApp',[])
.constant('ORDER_BY',['foo','bar','baz'])
.config(function(ORDER_BY){
  console.log(ORDER_BY);// ['foo','bar','baz']
})
;

参考:
constant, value, service, factory, providerの使い分け - AngularJS - angular.jsメモ - Qiita

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。