1

The app loads from a library which includes a text "no data", we can't change the library directly and I wonder if a component can find that text and replace it with something like "select a project". I found an example with regex, but I couldn't make it work

2
  • it is unclear, you should add more information, what did you try? Commented Jan 4, 2020 at 22:15
  • please add full context and the code that you tried so far Commented Jan 5, 2020 at 1:06

2 Answers 2

4

You can do it using the property textContent.

Example:

Given this HTML fragment:

<div id="element">This is your text!</div>

then set the element's text content:

document.getElementById('element').textContent = 'This text is different!';
// The HTML for id 'element' is now:
// <div id="element">This text is different!</div>
Sign up to request clarification or add additional context in comments.

Comments

0

As mention in heading its related to Angular (not angular js)

HTML :
<button id="one" (click)="userClicked($event)"  ngClass="mybtn">initTxt</button>

.TS:
userClicked(event:any){
 event.target.textContent  = "updated text";
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.