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.