0

I am creating an EDM music directory web-sight and I am having issues with the content.

There are tons of genres and sub-genres of EDM and I don't want to create a new page for each one (if possible)

Is there a way to switch the content of an HTML web-sight based on the value of a button? In other words, I want a HTML template with all the styling for the genre. But I want to change the text, images and audio that goes into it.

Akash lal
  • 314
  • 6
  • 18
Krontime
  • 11
  • 2
  • I think you need partials/templates (`ng-view`) with specific routing in `angular.config`. You need to use [`$routeParams`](https://stackoverflow.com/questions/11534710/angularjs-how-to-use-routeparams-in-generating-the-templateurl) to extract the ID/name from the URL itself, e.g. `website.com/#!/music/9001`. Your route will be: `.when('/music/:id'`, and you can extract the ID with: `$routeParams.id` – Aleksey Solovey Jan 30 '18 at 16:50
  • I got it working! Now I have to make this work: – Krontime Feb 01 '18 at 14:27

1 Answers1

0

Yes sure You can add a class or id to the button while rendering then simply add event listeners for click action In the listener You can run this.innerText to access the buttons text After all processing , you can get the entire document HTML by window.document.body.innerHTML and set by assigning value to this property of body I suggest you rather use classes or id of elements to change them or rather run element.childNodes[index] to change elements on your web-page

Abhishek Mathur
  • 478
  • 5
  • 12