Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stig Kulvedrøsten 48 posts 69 karma points
    Mar 09, 2014 @ 11:16
    Stig Kulvedrøsten
    0

    Angularjs routing in custom section

    I've created a custom section and have a custom tree like this:

    [Tree("CustomData", "Reports", "DataTable", iconClosed: "icon-doc")]
    [PluginController("CustomData")]

    The section and tree is rendered correctly and when I click create the create.html is loaded from 'App_Plugins/CustomData/Reports/create.html'. So far so good

    But in the create.html I have a couple of options:
    <a href="#/CustomData/Reports/edit/?create=true" ng-click="nav.hideNavigation()">New datatable</a>
    <a href="#/CustomData/Reports/import" ng-click="nav.hideNavigation()">Import datatable</a>

    When clicking these links angularjs is looking for views in 'Umbraco/Views/Reports/'

    I'm guessing my urls in create.html are wrong. How can I make angularjs look in the app_plugins folder? What are the correct url's that I can use in my views?

    Stig

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 10, 2014 @ 18:21
    Jeroen Breuer
    0

    Hello,

    This topic is also about AngularJS and routing: http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/48392-Custom-Dashboard-(UkFest-AngularJS-Demo)

    Maybe it can help.

    Jeroen

  • Pau 14 posts 75 karma points
    Apr 30, 2015 @ 10:47
    Pau
    1

    Hi Stig,

    I had the same problem, here is the solution i found:

    I created a function on the controller that looks like this (i change my parameters for yours):

    $scope.goto = function (loc,nav) {

            $location.path("loc");

            nav.hideNavigation();

        };

    and you will need to change your <a> to this:

    <a href="#" ng-click="goto("/CustomData/Reports/edit/?create=true",nav)">New datatable</a>

    That will redirect you to your edit.html in your reports section

    Don't forget to add $scope and  $location to your controller

     

Please Sign in or register to post replies

Write your reply to:

Draft