I created an Angular component which has a navbar, which is created as an unformatted list. By clicking on a list element, I want to call a method from the component.ts, which changes the showed component within this component.
I am an absolute beginner to Angular and web development, so I need help to solve that.
I tried using button oncklick="methodcall()" and a href="methodcall()" in the list element, which both worked. But using a button changes the styling of my navbar icons and a link shows the function call in the uri. I don't want any of this side effects.
html:
<nav>
<ul>
<li onclick="switch('page1')">page1</li>
<li onclick="switch('page2')">page2</li>
</ul>
</nav>
component.ts:
switch(propertyName: string) {
...
}
An easy way to call the method without changing my styling or the uri would be great!