interpolation not working properly while dynamically change value
See original GitHub issueπ bug report
interpolation throws error while dynamically change value
Description
I have tried to update value dynamically using interpolation but it throws below error:
I have created components like below :
import { Component, ViewEncapsulation} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
constructor() { }
public rtedataSource: string = "<p>One</p>";
checkRTE(){
this.rtedataSource ="asffsdffsf"
}
}
Error:
π¬ Minimal Reproduction
-
Download below sample: Angular_issue.zip
-
give below commands
npm i
ng serve
π₯ Exception or Error
But if i use changeDetection: ChangeDetectionStrategy.OnPush, it doesnβt throws any error and interpolation working fine.
Reference code:
import { Component, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef} from'@angular/core';
@Component({
selector:'app-root',
templateUrl:'app.component.html',
styleUrls: ['app.component.css'],
encapsulation:ViewEncapsulation.None,
changeDetection:ChangeDetectionStrategy.OnPush
})
exportclassAppComponent {
constructor(privateref:ChangeDetectorRef) {
ref.detach();
setInterval(() => { this.ref.detectChanges(); }, 100);
}
publicrtedataSource:string="<p>One</p>";
checkRTE(){
this.rtedataSource="asffsdffsf"
}
}
π Your Environment
Angular Version:
Angular CLI: 7.0.3
Node: 8.9.3
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.10.3
@angular-devkit/core 7.0.3
@angular-devkit/schematics 7.0.3
@schematics/angular 7.0.3
@schematics/update 0.10.3
rxjs 6.3.3
typescript 3.1.3
Anything else relevant?
I just want to know why this happening?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:14 (6 by maintainers)
Top Results From Across the Web
ngClass with string interpolation to dynamically change it
I need to change with variables the classes applied to a div, but not all. In the following example I need a class...
Read more >Developer Guide: Interpolation - AngularJS: API
Dynamically changing an interpolated value. You should avoid dynamically changing the content of an interpolated string (e.g. attribute value or text node).
Read more >Python string interpolation (Make Dynamic Strings) - Like Geeks
In this tutorial, you'll learn about Python string interpolation by: concatenation, the modulo operator, the format method, Using f-strings,Β ...
Read more >[Solved]-Angular 6 String Interpolation not updating with value ...
Coding example for the question Angular 6 String Interpolation not updating with value inside .subscribe()-angular.js.
Read more >String interpolation - C# tutorial - Microsoft Learn
One or more interpolation expressions. An interpolation expression is indicated by an opening and closing brace ( { and } ). You can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kumaresan-subramani Then I think it is the issue for https://github.com/syncfusion/ej2-angular-ui-components/issues.
@kumaresan-subramani OK, from that simple demo it was not clear. If you know the reason why didnβt you explain it? And what do you expect now? Do you think that somebody would analyze how
<ejs-tooltip>
component is working, which timeline is exactly using and so on?If it is a real Angular problem then demonstrate it using the pure code without using any libs.