Angular-cli: angular cli not conform with angular documentation

Created on 11 May 2016  路  7Comments  路  Source: angular/angular-cli

Angular Cli projects are not conform with the angular documentation. For example

import {HTTP_PROVIDERS, Http} from 'angular2/http';

does not work

Most helpful comment

@doczoidberg If you are using the latest version of angular-cli you don't have the package installed by default. You need to run npm install @angular/http --save

All 7 comments

@doczoidberg , try this => import {HTTP_PROVIDERS, Http} from '@angular/http'
With the rc version, all namespace have change. https://github.com/angular/angular/blob/master/CHANGELOG.md

c:/temp/app1e/tmp/broccoli_type_script_compiler-input_base_path-rlvaekkB.tmp/0/src/main.ts (5, 30): Cannot find module '@angular/http'.

Maybe it's not present on your package.json. Can you check it ?

@doczoidberg If you are using the latest version of angular-cli you don't have the package installed by default. You need to run npm install @angular/http --save

works now, thanks

You should also inject HTTP_PROVIDERS in main.ts

bootstrap(HELLOAppComponent, [HTTP_PROVIDERS]);

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daBishMan picture daBishMan  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

hartjo picture hartjo  路  3Comments