Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
NavBar igx-icon event handling
posted

Good Morning

I will admit up front I am new to Angular and thus I need more details in using your controls than others probably do.

I can only get one event handler to fire yet the example and other tutorial I have seen on blog etc lead me to believe I should be able to have multiple buttons and events.

This is my HTML:

<igx-navbar id="GoG-NavMenu" title="GoG" actionButtonIcon="menu" (onAction)="actionExc($event)" isActionButtonVisible="true">
	<igx-icon>search</igx-icon>
</igx-navbar>

This is my component:

	public actionExc(event) {
		alert("asdfadsf");
	}

Now my hamburger menu shows and the alert displays onclick. The search glass also appears but all variations I can think of I can't get it to fire an event when clicked.

What am I doing wrong?

  • 2180
    Offline posted

    Hello John,

    The action button is the one on the left of the title (in your case the hamburger menu icon) and the onAction event is fired only for that button. You could subscribe to the search icon's click event like this:

    <igx-icon (click)="actionExc($event)">search</igx-icon>

    Let me know if I may be of any further assistance.

    Sincerely,
    Diyan Dimitrov
    Senior Software Developer