-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot annotate properly when the controller is inside an object #187
Comments
Will that code even work in Angular? If so, can you please link to documentation for the |
yes, it works in angular. |
Forgive me I didn't look at your code closely enough and thought that you were sending in |
Thanks for your reply, this is work for me, but adding |
hopefully not as annoying as manually creating an inject-array and keeping it consistent with the parameters. |
Just a note that this may become more of an issue as people begin to use something like Webpack to bundle assets together. Consider the following code: 'use strict';
function LoadingInterceptorConfig($httpProvider) {
$httpProvider.interceptors.push('LoadingInterceptor');
}
export default LoadingInterceptorConfig; then the import, itself: 'use strict';
import LoadingInterceptorConfig from './sample-loading-interceptor.config';
export default angular.module('sample.loadingInterceptor', [])
.config(LoadingInterceptorConfig); which creates (before ng-annotate runs) the following structure, which is essentially doing something similar to the problem described, e.g. accessing an object property to get the function reference. var _sampleLoadingInterceptorConfig = __webpack_require__(2);
var _sampleLoadingInterceptorConfig2 = _interopRequireDefault(_sampleLoadingInterceptorConfig);
'use strict';
exports['default'] = angular.module('sample.loadingInterceptor', [])
.config(_sampleLoadingInterceptorConfig2['default'])
module.exports = exports['default']; However, as @olov noted, adding the following does work, it'd just be ideal if somehow ng-annotate was able to work with a module bundler/object functions. 'use strict';
function LoadingInterceptorConfig($httpProvider) {
'ngInject';
$httpProvider.interceptors.push('LoadingInterceptor');
}
export default LoadingInterceptorConfig; |
@DSchau it's just hard to do that with static analysis and I don't believe it will happen. |
#183
I found that if controller is in a object, ng-annotate will ignore it. Is it possible to support that structure?
thanks.
The text was updated successfully, but these errors were encountered: