无法在角度$ mdDailog中加载模板

时间:2018-01-27 23:45:55

标签: javascript angularjs angularjs-material mddialog angularjs-compile

我在angularjs应用程序中使用$ mdDailog。我有addUser()函数,在ng-click操作时调用。在addUser()里面使用$ mdDailog.show()。我在templateUrl中传递html文件路径以加载。

我收到错误错误:[$ compile:tpload]无法加载模板:editUser.html

控制器功能:

function addUser(ev) {
           $mdDialog.show({
           controller: DialogController,  
           templateUrl: 'editUser.html',
           parent: angular.element(document.body),
           targetEvent: ev,
           clickOutsideToClose: true,
          });

的index.html

 <md-button class="md-padding" id="popupContainer"  ng-click="vm.addUser($event)" ng-cloak>Add User</md-button>

editUser.html:

<div>
    <md-dialog aria-label="Mango (Fruit)">
        <p>Here I will place my input elements</p>
  </md-dialog>
</div>

1 个答案:

答案 0 :(得分:0)

您必须传递相对于基本URL的路径:

library(ggplot2)

test <- data.frame(date = as.Date(c("2018-01-17", "2018-01-18", "2018-01-19", "2018-01-20","2018-01-21", "2018-01-22", "2018-01-23", "2018-01-24", "2018-01-25", "2018-01-26", "2018-01-27", "2018-01-17", "2018-01-18", "2018-01-19", "2018-01-20", "2018-01-21", "2018-01-22", "2018-01-23", "2018-01-24", "2018-01-25", "2018-01-26", "2018-01-27")), 
                   variable = c("foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar", "bar"), 
                   value = c(14L, 18L, 22L, 15L, 32L, 27L, 6L, 3L, 2L, 10L, 23L, 16L, 22L, 28L, 31L, 56L, 57L, 23L, 17L, 12L, 33L, 54L),
                   stringsAsFactors = FALSE)

ggplot(test, aes(date, value, colour = variable, label = value)) +
    geom_line() + 
    geom_text(hjust = 0, vjust = 0, show.legend = FALSE) + 
    scale_x_date(date_breaks = 'day', 
                 date_labels = '%b %d\n%a')