angular - angular2 CLI HTTP not found error -


i've created new angular2 application using angular-cli. trying data api using http. code i've written:

movies.service.ts

import { injectable } '@angular/core'; import { movie } './movie'; import { http, response } '@angular/http'; import { observable } 'rxjs/observable'; import 'rxjs/rx'; 

my atom editor gives error on @angular/http line. so, i've manually installed angular2 using npm install angular2 on project folder , modify error generated line this:

import { http, response } 'angular2/http'; 

but console showing:

"networkerror: 404 not found - http://localhost:4200/angular2/http/index.js"

i've added in index.html page following script:

<script src="https://code.angularjs.org/2.0.0-beta.17/http.dev.js"></script> 

and in package.json files dependencies "angular2": "2.0.0-beta.17",. still same error.

anyone have clue? i'm newbie in angular2. so, or suggestion highly appreciated.

i think mixed beta version , rc version.

in beta versions, there bundled js files preregisters modules name. that:

<script src="node_modules/angular2/bundles/angular2.min.js"></script> <script src="node_modules/angular2/bundles/http.min.js"></script> 

in case, there no need custom configuration angular2 modules in systemjs:

<script>   system.config({     packages: {             app: {         format: 'register',         defaultextension: 'js'       }     }   }); </script> 

with rc version, angular2 don't provide (yet) , need configure explicitly systemjs angular2 modules:

var map = {   'app':                        'app', // 'dist',   'rxjs':                       'node_modules/rxjs',   'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',   '@angular':                   'node_modules/@angular' };  var packages = {   'app':                        { main: 'main.js',  defaultextension: 'js' },   'rxjs':                       { defaultextension: 'js' },   'angular2-in-memory-web-api': { defaultextension: 'js' }, };  var packagenames = [   '@angular/common',   '@angular/compiler',   '@angular/core',   '@angular/http',   '@angular/platform-browser',   '@angular/platform-browser-dynamic',   '@angular/router',   '@angular/router-deprecated',   '@angular/testing',   '@angular/upgrade', ];  packagenames.foreach(function(pkgname) {   packages[pkgname] = { main: 'index.js', defaultextension: 'js' }; });  var config = {   map: map,   packages: packages }  if (global.filtersystemconfig) { global.filtersystemconfig(config); }  system.config(config); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -