The browser does not show the changes of the variables in the ".ts" files - Angular

3

I'm doing a small project in Angular , and nothing else to start I've run into an unexpected problem. First of all, I make it clear that both the project and the component I am using are newly created, I have only changed what is essential.

app-component.html :

<h1>
  {{title}}
</h1>
<app-cabecera></app-cabecera>

app-component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app works!';
}

cabecera.component.html

<p>
  Esto es el texto de la cabecera: {{texto}}
</p>

cabecera.component.ts

import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'app-cabecera',
    templateUrl: './cabecera.component.html',
    styleUrls: ['./cabecera.component.css']
})

export class CabeceraComponent implements OnInit {
    texto:string;
    constructor() { 
        this.texto='ejemplo';
    }
    ngOnInit() {
    }
}

My problem is that the changes I make to the variables in my .ts files are not updated automatically (or by reloading the page). If I put plain text in the HTML they are updated without problems, but the modifications in the variables called with {{texto}} or {{title}} are not reflected (unless you finish manually ng serve and rerun it ).

I've been thinking about it a lot and I do not understand why it can not work, as I said, it's new files.

    
asked by Paco Porras 02.02.2017 в 18:40
source

1 answer

1

You may have spaces or special characters in the folder of your project or in the top directory, it is a problem reported with Angular-cli: link

Greetings.

    
answered by 10.02.2017 в 12:24