This is a migrated thread and some comments may be shown as answers.

Menu, closeOnClick, anchor and Angular/ngRoute

4 Answers 142 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Patrick asked on 23 Aug 2014, 05:11 PM
It seems the closeOnClick does not fire correctly (at all) when there is an anchor tag in the menu and you're using Angular/ngRoute. See example below. Is this a bug or am I missing something.

Thanks,
Patrick

<ul data-kendo-menu style="display: inline-block; min-width: 80px;">
    <li>
        Men's
        <ul>
            <li>
                <a href="#/FootWear">Footwear</a>
            </li>
            <li>
                <a href="#/Leisure Clothing">Leisure Clothing</a>
            </li>
            <li>
                Sports Clothing
            </li>
            <li>Accessories</li>
        </ul>
    </li>
</ul>

4 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 26 Aug 2014, 02:10 PM
Hi Jospeh,

I am not sure what goes on in that case, the menu below does not seem to have event handler assigned. Can you re-create it in a dojo sample? We will investigate it and hopefully address it.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Patrick
Top achievements
Rank 2
answered on 26 Aug 2014, 07:10 PM
Sure. Give this one a try. Let me know if you have any issues. This is my first attempt at creating one.

Thanks,
Patrick
0
Accepted
Petyo
Telerik team
answered on 28 Aug 2014, 12:30 PM
Hello Joseph,

thank you for the clarification. The behavior is not related to AngularJS, and is by design – the menu expects the link click to navigate to another page and remains open. However, in the SPA context this is far from perfect. I will log this for further investigation; I think that we should close the menu if the link is an anchor one. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Patrick
Top achievements
Rank 2
answered on 28 Aug 2014, 01:52 PM
Thanks for the reply and I hope it can be fixed in the next release. For now I've made the following change when checking if it's a link.

From:
sampleHref = $("<a href='#' />").attr("href"),
isLink = (!!href && href !== sampleHref),

To:
sampleHref = $("<a href='#' />").attr("href"),
isLink = (!!href && href[0] !== sampleHref),




Tags
Menu
Asked by
Patrick
Top achievements
Rank 2
Answers by
Petyo
Telerik team
Patrick
Top achievements
Rank 2
Share this question
or