javascript - Error running ng serve -aot command in Angular 2 project -


i'm having error when run angular 2 project following command:

ng serve -aot 

stack trace:

error in ./src/app/app.module.ngfactory.ts module build failed: error: /users/iguissouma/ideaprojects/myproject/frontend/src/app/shared/services/message.service.ts (9,5): public property 'messagesource$' of exported class has or using name 'observable' external module "/users/iguissouma/ideaprojects/myproject/frontend/node_modules/rxjs/observable" cannot named.)     @ _transpile (/users/iguissouma/ideaprojects/myproject/frontend/node_modules/@ngtools/webpack/src/loader.js:101:19)     @ /users/iguissouma/ideaprojects/myproject/frontend/node_modules/@ngtools/webpack/src/loader.js:128:26     @ trycatch (/users/iguissouma/ideaprojects/myproject/frontend/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:195:12)     @ invokecallback (/users/iguissouma/ideaprojects/myproject/frontend/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:210:13)     @ publish (/users/iguissouma/ideaprojects/myproject/frontend/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:178:7)     @ flush (/users/iguissouma/ideaprojects/myproject/frontend/node_modules/es6-promise/dist/lib/es6-promise/asap.js:94:5)     @ nexttickcallbackwith0args (node.js:420:9)     @ process._tickcallback (node.js:349:13)  @ ./src/main.ts 4:0-64  @ multi main 

the app works fine ng serve

how fix problem?

message.service.ts

import { injectable } '@angular/core' import { subject } 'rxjs/subject'; import { message } 'primeng/primeng';  @injectable() export class messageservice {     messagesource = new subject<message>();      messagesource$ = this.messagesource.asobservable();      info(summary : string, detail : string) {         this.messagesource.next({severity:'info', summary: summary, detail: detail});         console.log("info: " + summary + " detail: " + detail);     }      error(summary : string, detail : string) {         this.messagesource.next({severity:'error', summary: summary, detail: detail});         console.log("error: " + summary + " detail: " + detail);     } } 

i modified message.service.ts below declare explicit types fields:

import { injectable } '@angular/core' import { subject } 'rxjs/subject'; import { message } 'primeng/primeng'; import { observable } 'rxjs/rx';  @injectable() export class messageservice {     messagesource:subject<message> = new subject<message>();      messagesource$:observable<message> = this.messagesource.asobservable();      info(summary : string, detail : string) {         this.messagesource.next({severity:'info', summary: summary, detail: detail});         console.log("info: " + summary + " detail: " + detail);     }      error(summary : string, detail : string) {         this.messagesource.next({severity:'error', summary: summary, detail: detail});         console.log("error: " + summary + " detail: " + detail);     } } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -