Copied to clipboard

Flag this post as spam?

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


  • edwich44 15 posts 71 karma points
    Dec 04, 2014 @ 13:54
    edwich44
    0

    Using ng-view in custom propertyEditor

    Hi guys,

    Im trying to create a custom propertyEditor in which I want to load different html templates based on what link is clicked by the user.

    I have been reading some articles about how to achieve this with Angular and the articles mentioned using $route service. This is what I have come up with :-

    umb.config(function ($routeProvider, $location) {
    $routeProvider.when('/hello', {
         templateUrl: '/App_Plugins/CustomEditor/hello.html',
         controller: 'helloController'
    })
    

    I found out that in order to inject that template into my main propertyEditor html file I should use the ng-view attribute

    <a href="/hello"><p class="goalWidgetEdit">Edit</p></a>
    <div ng-view></div>
    

    So the idea is if the user clicks the link, it should load the template mentioned above in the div containing ng-view.

    However everytime I go to view the content node which contains this custom propertyEditor it doesnt load. It doesnt load even before clicking the link, so im guessing the issue could be the ng-view. When I remove ng-view, it loads but obviously the template wont display when clicking on the link.

    Can anyone help or advice on another method to achieve this.

    Thank you

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Dec 04, 2014 @ 14:32
    Dave Woestenborghs
    102

    I think you need to use ng-include instead of ng-view. Ng-view is tied to the routing and that can mess up the innerworking of the backend.

    See https://code.angularjs.org/1.1.5/docs/api/ng.directive:ngInclude

    Dave

  • edwich44 15 posts 71 karma points
    Dec 04, 2014 @ 14:42
    edwich44
    0

    @Dave

    Great, thank you for the info and quick response.

    :)

Please Sign in or register to post replies

Write your reply to:

Draft