ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
411 stars 36 forks source link

getinjectablename does not work in alpha 0.07 #92

Closed david-gang closed 8 years ago

david-gang commented 8 years ago

Hi all,

I import a class from another module which is Injectable

import {X} from './y';
import {getInjectableName} from '.ng-forward/cjs/util/get-injectable-name'//some weird import path
angular.module('z').factory('A',A);

function A(x) {
}

A.$inject = [getInjectableName(X)];

I get an error

Uncaught TypeError hasOwnMetadata @ Reflect.js:290_map @ metastore.ts:7has @ metastore.ts:23getInjectableName @ get-injectable-name.ts:15302.../

I tried again to debug but because of the source maps problems i could not get into the code of ng-forward. In the reflect-metadata code except the first parameters the second and third were undefined. This crashed the system .

timkindberg commented 8 years ago

Seems to be working for me: http://plnkr.co/edit/gwM0Y3XEQXMwGY1YlCZ7?p=preview

I did modify several things from your snippet above: