This topic contains 5 replies, has 2 voices, and was last updated by Sean Sean 2 years, 9 months ago.

handleTabs and Angular


  • noy
    Participant

    Posts: 6
    Member Reply #921

    Hi,

    I’m trying to add tabs to an angular view. Everything works great but the handleTabs function isn’t working, not allowing me link to a specific tab (a required functionality).

    When I move handleTabs() from init() to initAjax(), I get the following error:

    https://docs.angularjs.org/error/$rootScope/inprog?p0=$digest

     

    Any assistance would be greatly appreciated! ๐Ÿ™‚

    Noy.

    Sean
    Sean
    Keymaster

    Posts: 4226
    Support Staff Reply #974

    Hi :),

    Please note passing tab id via # will not work in AngularJS version since it can be conflicted with AngularJS’s main URL separator. In your case you should try other solutions:

    http://stackoverflow.com/questions/16872191/angularjs-ui-bootstrap-tabs-that-support-routing
    http://stackoverflow.com/questions/23232569/select-angular-ui-tab-by-url-parameter

    Thanks.


    noy
    Participant

    Posts: 6
    Member Reply #1012

    Thank you for your rapid response ๐Ÿ™‚

    I did understand the hash problem, therefore I’ve changed:

    var tabid = location.hash.substr(location.hash.lastIndexOf('#') + 1);
    <small>metronic.js:266</small>

    to:

    var tabid = location.hash.substr(location.hash.lastIndexOf('#') + 1);
    <small>metronic.js:266</small>

    Since the error is unrelated to location.hash and the tab’s id, the problem obviously persists.
    In the demo, you have stated that “All Metronic features from the HTML version(pages, layout options, components, plugins, etc) are fully compatible in the AngularJS version.”
    Your help would be greatly appreciated! ๐Ÿ™‚

    Sean
    Sean
    Keymaster

    Posts: 4226
    Support Staff Reply #1042

    Hi :),

    Very sorry for the late reply.

    Can you try to pass it through URL parameter(page.html?tab=tab1) ?

    var tabid = location.hash.substr(Metronic.getURLParameter(‘tab’));

    Thanks.

     


    noy
    Participant

    Posts: 6
    Member Reply #1043

    Hi Sean,

    Thank you for your rapid response! ๐Ÿ™‚

    The problem is not with locating \ activating the suitable tab, but with applying the whole function.

    When I move handleTabs() from init() to initAjax() (which is required for initialization when changing ui-router states), I get the following error:

    https://docs.angularjs.org/error/$rootScope/inprog?p0=$digest

     

    Thanks,

    Noy.

    Sean
    Sean
    Keymaster

    Posts: 4226
    Support Staff Reply #1086

    Hi,

    Sorry for the late reply. We have been super busy nowadays with overloaded support requested.

    We tried to addย handleTabs() into initAjax function and it worked well. Can you retry it if its working OK if you don’t pass any extra parameter through URL ? If possible can you provide us a test link to your developing site so we can check it online and help you more effectively.

    Thanks.

Tagged: 

You must be logged in to reply to this topic.