Closed lili21 closed 8 years ago
From your example, /* @inject */
does not affect ng-annotate at all. ng-annotate succeeds in annotating one of the cases anyways using static analysis.
As for how to write the comment, do it however you want. /* @ngInject */
, /*@ngInject*/
, /** @ngInject */
, // foo @ngInject bar
etc all work fine. But the recommended way is to use "ngInject"
, as pointed out in the README.
@olov You meat ng-annotate understands
angular.module('app', [])
.ctrl('ctrl', ctrl)
.factory('NsServer', NsServer)
and does not understand
_angular2.default.module('app').factory('NsServer', NsServer)
That's correct. You can teach it to understand the latter form as well, see https://github.com/olov/ng-annotate/blob/master/IMPLICIT.md (search for regexp on page).
@olov Now I got it. Thanks. Awesome job, by the way.
the
readme
dose not cover well. Do all those comment way work ?how many comments way can be used ?
and here is the weird situation I meet with。I am using ng-annotate-loader.
It works well when using
/** @ngInject */
。no
$inject
forNsServer
, so it does not work when using/** @inject */
. right ?But how about this ?
Looks like working fine.
the only difference between those
/** @inject */
situations is the size of the code bases.So what is the safest way to make it work ?