Reputation: 440
I want to change the values when I receive the data from the provider.
ngOnInit() {
this.recapServiceProvider.getRecapPremevementt().subscribe(data => {
this.recap = data;
this.recap.forEach(element => {
this.recap.type=element.type.toUpperCase();
console.log(this.recap.type);
});
console.log(this.recap);
});
}
When I try to console the "console.log(this.recap.type)
", it shows me that the type is in upper case but on the dom and on the second console.log(this.recap)
nothing changes.
How I can resolve that problem ?
Upvotes: 0
Views: 46
Reputation: 21397
You can use a built in Pipe for that
{{recap.type| uppercase}}
Upvotes: 1
Reputation: 694
I think this is what you looking for.
this.recapServiceProvider.getRecapPremevementt()
.map(data => data.map(el => el.type.toUpperCase()))
.subscribe(data => {
console.log(data);
});
Upvotes: 0