What prevents my AngularJs 2 application from executing the commands shown in the inspector?

I am experimenting with Angular 2. I use npm startto create a live coding environment in Chrome, and I see unusual behavior.

An early version of my code base appeared in the A.service.ts file:

export class AService{
    constructor( private http : Http ){}
    test( valueA : string, valueB : string ){
        var dataObj = { valueA, valueB }
        console.log( dataObj );
        console.log( this.http );
    }
}

After starting my program, the console will successfully display two objects. The first object showed me the values ​​"valueA" and "valueB", and the second object was an Http object that showed me that my service is loading correctly and the method is called with the expected values. For future reference, we will call this console log template "Output A".

. . . . " ".

, , " A".

, , :

export class AService{
    constructor( private http : Http ){}
    test( valueA : string, valueB : string ){
        console.log( "Testing AService. Method called successfully.");
    }
}

, " AService...", " A" . .ts, .js, . Chrome , OLD.

Ctrl-C npm npm start, ....

! , ?

, :

enter image description here

.js , .js. , , , NPM.... - NPM JavaScript TSC .

+4
1

, , , NPM.... - NPM JavaScript TSC .

. .

+1

Source: https://habr.com/ru/post/1667564/


All Articles