angularjs - provide is not defined -
my angularjs2 gives me angular2-polyfills.js:138 error: provide not defined main.ts
. codes is:
import {bootstrap} 'angular2/platform/browser'; import {appcomponent} './app'; import {router_providers,router_directives} 'angular2/router'; import {platform_directives} 'angular2/core'; bootstrap(appcomponent, [provide(platform_directives, {usevalue: [router_directives], multi:true})]);
anyone has idea?
update
in angular2 rc.4 , later provide
deprecated. use object literal syntax instead:
bootstrap(appcomponent, [{provide: someservice, useclass: someotherservice}]) @component({ providers: [{provide: someservice, useclass: someotherservice}], ... })
original
you need import it. it's exported angular2/core
:
import {platform_directives, provide} 'angular2/core';
Comments
Post a Comment