javascript - How do I declare a dependency on an ng-metadata module? -


i have project using ng-metadata (https://github.com/ngparty/ng-metadata) build handful of angular 1.5 modules. have test module/component looks this:

import { ngmodule, component, inject, input, output, eventemitter } 'ng-metadata/core' import { platformbrowserdynamic } 'ng-metadata/platform-browser-dynamic'  @component({     selector: 'test',     template: require('./test.template.html') }) class testcomponent {      @input() type: string;      constructor() {         console.log(`test: ${this.type}`)     }  }  @ngmodule({     declarations: [testcomponent] }) class heromodule {}  platformbrowserdynamic().bootstrapmodule(heromodule) 

everything seems happy when compiled , i'm attempting use module in project (that not using ng-metadata has compatible version of angular).

i'm including shims directed ng-metadata docs , javascript file contains module described above (built webpack). have new module in project wants list heromodule dependency. i've tried few things:

// attempt 1: angular.module('my-consuming-module', ['ui.router', 'hero'])  // attempt 2: angular.module('my-consuming-module', ['ui.router', 'heromodule'])  // attempt 3: angular.module('my-consuming-module', ['ui.router', 'hero-module']) 

all end same error: $injector:nomod module unavailable error angular.

if i'm using ng-metadata build modules, names use list them dependencies in project?

you need import module respective locations , inject inside angular module

//ensure `angular`, `angular-ui-router` should there in `map` of systemjs.config.js import * angular 'angular'; import * uirouter 'angular-ui-router'; import { heromodule} './hero.module';  angular.module('app',[ uirouter, heromodule]); 

check references here


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -