Skip to content

Named Function Annotation #9

@patrickhousley

Description

@patrickhousley

I do not seem to be able to use a named function without including the annotation above it.

import '../common/responsive.service'
import '../common/cookie.service'

module.service('menuConfigService', MenuConfigService);

function MenuConfigService(responsiveUtils, cookieService) {
  var cfg = {};

  var keys = Object.keys(bladeData);
  keys.forEach(function (key) {
    var keyData = _.cloneDeep(bladeData[key]);
    if (typeof keyData === 'object' && keyData.data) {
      keyData.data = convertMobileData(keyData['data'], responsiveUtils, cookieService);
    }
    cfg[key] = keyData;
  });

  return cfg;
}

The above code will result in an error stating MenuConfigService is not using explicit annotation. This does appear to be supported by ng-annotate olov/ng-annotate#57. Is this an issue with the loader?

  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        loader: 'ng-annotate-loader!babel-loader?stage=0',
        exclude: /web_modules|node_modules|bower_components/
      },
      {test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url-loader?limit=10000'},
      {test: /\.json$/, loader: 'json-loader'},
      {test: /\.jade$/, loader: 'raw!sprint-jade-loader'}
    ]
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions