页面模板未呈现

时间:2018-10-17 05:20:22

标签: angularjs

我有此配置

  angular.module('BlurAdmin.pages.form', ['ui.select', 'ngSanitize', 'textAngular'])
      .config(routeConfig);

  /** @ngInject */
  function routeConfig($provide, $stateProvider) {

    $provide.decorator('taOptions', ['taRegisterTool', '$delegate', function(taRegisterTool, taOptions) { // $delegate is the taOptions we are decorating

    taOptions.toolbar = [
        ['pre', 'quote','bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear','justifyLeft', 'justifyCenter', 'justifyRight', 'indent', 'outdent', 'insertImage','insertLink', 'insertVideo'],
        []
    ];
        return taOptions;
    }]);

    $stateProvider
        .state('form', {
          url: '/form',
          template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
          abstract: true,
          title: 'Form Elements',
          sidebarMeta: {
            icon: 'ion-compose',
            order: 250,
          },
        })
        .state('form.campaigns', {
          url: '/campaigns',
          templateUrl: 'app/pages/form/campaigns/campaigns.html',
          title: 'Campaigns',
          controller: 'CampaignsCtrl',
          sidebarMeta: {
            order: 0,
          },
        })
        .state('form.campaigns.detail', {
          url: '/:label',
          // templateUrl: 'app/pages/form/campaigns/campaigns-details.html',
          templateUrl: 'app/pages/components/mail/detail/mailDetail.html',
          title: 'Campaign and Questions1',
          controller: "MailListCtrl",
          controllerAs: "listCtrl"
        })

文件campaigns.html中没有,我有一个类似<p class="bold grey" ui-sref="form.campaigns.detail({id: '123', label: 'aaa'})">CLICK</p>的链接。

现在,当我单击“单击”时,页面的标题将更改为Campaign and Questions1,但是模板的URL仍然是相同的,即campaign.html而不是mailDetail.html

1 个答案:

答案 0 :(得分:0)

在ng-view下方尝试此操作,因为ui-router中使用ui-view,而ng-view使用angularjs默认路由器,(如果您使用ui-view,则必须安装ui-router

  template : '<ng-view autoscroll="true" autoscroll-body-top></ng-view>',