Menu, closeOnClick, anchor and Angular/ngRoute

5 posts, 1 answers
  1. Patrick
    Patrick avatar
    19 posts
    Member since:
    Jul 2010

    Posted 23 Aug 2014 Link to this post

    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>
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 26 Aug 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Patrick
    Patrick avatar
    19 posts
    Member since:
    Jul 2010

    Posted 26 Aug 2014 in reply to Petyo Link to this post

    Sure. Give this one a try. Let me know if you have any issues. This is my first attempt at creating one.

    Thanks,
    Patrick
  5. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 28 Aug 2014 Link to this post

    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!
     
  6. Patrick
    Patrick avatar
    19 posts
    Member since:
    Jul 2010

    Posted 28 Aug 2014 in reply to Petyo Link to this post

    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),




Back to Top
Kendo UI is VS 2017 Ready