AngularJS with node -webkit

I am currently evaluating node-webkit as a possible solution for building a web-based desktop application and has a small problem. The application uses AngularJS, and the problem I am facing is apparently the incorrect loading of the html template files.

My test application has this configuration:

nucleusApps.config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) { $locationProvider.html5Mode(true); $routeProvider .when('/style', { templateUrl: '/templates/core/style.html', controller: nucleusApps.controllers.Style }) .otherwise({redirectTo: '/style'}); }]); 

The problem is that I get the following error:

 Failed to load resource file://templates/core/style.html 

I tried several different formats for templateUrl, including:

 ./templates/core/style.html file://template/core/style.html 

But I keep getting this error. Also my directory structure:

 -index.html -package.json -css -file.css -etc... -templates -core style.html -etc... 

This is what is encrypted.

Do you know why I can get this error?

- UPDATE -

Not sure what is going on here, but just updated my code (the web version that I am creating) and now everything is working fine. There must be something strange in the older code.

+4
source share
1 answer

I still need to use html5mode, but that is the problem. $ locationProvider,

+1
source

Source: https://habr.com/ru/post/1447256/


All Articles