Questions tagged [ng-annotate]

ng-annotate adds and removes AngularJS dependency injection annotations.

ng-annotate is non-intrusive so your source code stays exactly the same otherwise. No lost comments or moved lines. Annotations are useful because with them you're able to minify your source code using your favorite JS minifier.

The package is hosted on GitHub.

25 questions
22
votes
4 answers

ngAnnotate - Warning: StringMap expected string key

I get this warning when using Grunt and grunt-ng-annotate. There is no reference in the warning to where the error is in the file, which makes debugging it hard. Any ideas?
iss42
  • 2,720
  • 3
  • 21
  • 37
17
votes
1 answer

ng-annotate error with Babel and destructuring

Strange error when transpiling to ES6 with Babel, ng-annotate doesn't like destructuring. I copied my source into the online babel compiler and it works fine. Commenting out ng-annotate in my gulp pipe chain gets rid of the error. Removing the /*…
Phix
  • 9,364
  • 4
  • 35
  • 62
6
votes
1 answer

Can SystemJS plugins modify already transpiled files?

While attempting to get Angular (1.x) working with systemjs I realized that there is not currently the capability (that I know of) to automatically insert $inject into angular components, which keeps the components working even when the arguments to…
Avi Cherry
  • 3,996
  • 1
  • 26
  • 31
4
votes
1 answer

Webpack, angular and ng-annotate-loader — having troubles with annotating angular files

I am trying to bundle an Angular app using Webpack and am having problems after minification of the bundle. This syntax, with manual annotation of dependencies, works: var app = angular.module('app', [ …
azangru
  • 2,644
  • 5
  • 34
  • 55
4
votes
2 answers

Pass data between gulp tasks without writing to disk

I'm trying to annotate and minify a systemjs angular project. Systemjs comes with a build function, but it is not `'gulp-aware'. There is the possibility to pass the builder an option to minify, but there is not one for ng-annotate, so I will need…
Simon H
  • 20,332
  • 14
  • 71
  • 128
3
votes
1 answer

grunt-ng-annotate all angularjs files

I want to run ng-annotate via grunt on all my project's angular files. Could not find this option. I only have the option annotate by specify file name. ngAnnotate: { dist: { files: { 'output_file_name.js':…
chenop
  • 4,743
  • 4
  • 41
  • 65
2
votes
0 answers

ng-strict-di doesn't recognise 'ngInject'

I'm using Rails 4.0 with AngularJS 1.5 and the ng-annotate gem. I've noticed that when I put on the 'ng-strict-di' which forces you to annotate all your direct injections in AngularJS I find that Rails complains about modules which have "ngInject"…
map7
  • 5,096
  • 6
  • 65
  • 128
2
votes
0 answers

Is there a reason I would need both ng-annotate-loader and ng-annotate-webpack-plugin?

I recently inherited a project written in AngularJS v1.6.x and using Webpack v3.x.x. Upon inspecting the package.json, I noticed that both ng-annotate-loader and ng-annotate-webpack-plugin are listed within the devDependencies section. While…
Chris Harris
  • 1,329
  • 4
  • 17
  • 28
2
votes
1 answer

upgrading to rails 5.1.2 from rails 4.20 breaks Angular integration

I am upgrading my rails 4.2.0 app to 5.1.2 which is going fine. I had used Angular 1.x to enhance my rails app pages selectively. My rails views are in HAML. Here is a snippet of a page which loads fine in 4.2.0, but not in 5.1.2: .well{"ng-app"…
Bharat
  • 2,409
  • 6
  • 32
  • 57
2
votes
2 answers

Browserify + browserify-ngannotate + Tsify not working

I'm using gulp with browserify and tsify. This has been working quite well. Then I decided to add ng-annotate using browserify-ngannotate. I've added the ng-annotate browserify transform but it seems that if tsify is added as a plugin the…
Tersius
  • 267
  • 4
  • 17
1
vote
1 answer

Problems with grunt - Warning: Task "ngAnnotate:dist" failed. Use --force to continue

I'm having issues with a Grunt task that was running fine before. I'm not sure why this is happening now. Here's the error: Running "ngAnnotate:dist" (ngAnnotate) task Generating ".tmp/concat/scripts/scripts.js" from:…
Jeff
  • 19
  • 3
1
vote
1 answer

ECMA6 class-based controller with babel and ng-annotate/ngInject results in ReferenceError

I've an Angular 1.4 controller with a method that depends on a resource service. I've annotated the constructor of that class with ng-annotate, but still, Angular curses that service can't be found in the method: var MyResourceFactory =…
Boris Burkov
  • 13,420
  • 17
  • 74
  • 109
1
vote
2 answers

Angular module not available after grunt build even with ng-annotate

I am using Yeoman angular genarator. I created Angular module and I try to load it to the app. Grunt is using ng-annotate, vendor scripts (where module is) are loaded before app script, so I don't know what's the problem. This is commpressed…
1
vote
0 answers

grunt-ng-annotate adding source files for angular js

I am using grunt-ng-annotate for automatically injecting the dependencies in order to prevent them from getting minified. I have used the below task: ngAnnotate: { app:{ files: [{ expand: true, …
Ankit Tanna
  • 1,779
  • 8
  • 32
  • 59
1
vote
0 answers

ng-annotate with module constructor

Is it possible to use ng-annotate with angular module construction? For example, angular.module("testApp", ["ui.router"]) .controller("FrontController", function($scope, $window, $log) { ... }); gets annotated with the various…
Jason
  • 11,263
  • 21
  • 87
  • 181
1
2