前回valueとfactoryの違いを考えたので、今回はServiceとFactoryの違いを考えたいと思う。 違いはある?ない? とりあえずFactoryを使っているという声も聞かれるが、例えば angular-ui/ng-gridのGitHubのソースを見ると、下記のようなフォルダ構成になっていて、明示的に用途を分けている。 どういう意図で分けているのか、まず、What is the difference between module.factory and module.service and how might both be applied?のスレッドに書かれてることを意訳したい。 Service Services Syntax: module.service( 'serviceName', function ); Result: When declaring serviceNa
