0

Basically scenario is that i am getting URL parameter value in my home component and now i want to use this value on my index.html page.how we can do this?

6
  • How do you want to use it? As a title? Commented Feb 10, 2020 at 6:36
  • As in footer value Commented Feb 10, 2020 at 6:41
  • 1
    Why don't you have the footer in app.component.html? Commented Feb 10, 2020 at 6:42
  • i am using header and footer on index.html Commented Feb 10, 2020 at 6:43
  • It is not clear question. Commented Feb 10, 2020 at 7:22

1 Answer 1

1

You could use native javascript to set some text.

public class AppComponent implements OnInit {
    ngOnInit() {
        document.querySelector('#foo').innerText = 'bar';
    }
}

Or just move the header and footer from your index.html into your app.component.html. Propably the simplest way to solve your issue.

Sign up to request clarification or add additional context in comments.

2 Comments

can you please let me know if i want to add script file in app.component.html how i can do this?? like currently i am going with your solution to move header footer in app component but i am getting the header footer from some external source or third party. But i don't able to load "script.js" on my appcomponent.html template same script.js is loading on index.html. I am doing like this <script src="script.js"> "script.js can be any third party file name
If you can't change how the footer is loaded, then you probably have to use the native js way.

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.