javascripthtmlangularjswebpackng-dialog

how to find html file in ngDialog template with webpack?


Hello I have a problem while trying to use webpack to bunlde my files and ngDialog to get a popup to work. the popup will only show a "Hello!" message right now.

This is my function:

function popupEditOptions(){
    ngDialog.open({
        template: 'src/req/edit/editOptions.html',
        scope: $scope
    });
};

When i do this i get an error with:
GET http://localhost:3000/src/req/edit/editOptions.html 404 (Not Found)

I can require the html file like this:

function popupEditOptions(){
    ngDialog.open({
        template: require('src/req/edit/editOptions.html'),
        scope: $scope
    });
};

But now i get this error that writes out the content of the html file:
GET http://localhost:3000/Hello! 404 (Not Found)


Solution

  • It seems that it may be an bug in ngDialog, referenceing to this github question:https://github.com/likeastore/ngDialog/issues/390.

    But you can get it to work by using the plain:true property.

    ngDialog.open({
       plain: true,
       template: require('src/req/edit/editOptions.html'),
       scope: $scope
    });