I am build desktop application using nw js with angular js, I want to use ui-router for routing. I have written function handlers for api call I dont want http request. when I start application with nw js only index.html is loading template urls are not loading. I found application working with ngRoutes but I want to include states in my routes. How to do this?
Asked
Active
Viewed 243 times
0
-
Do you get any errors? Are you using non-minified angular for development? How are you loading your templates? If you are using template urls, you'll see those load under the network tab in chrome dev tools (F12), do you get 404s? Have you tried checking if the urls are correct? Are you using any kind of minification or packaging scripts? Posting what you have (yes, code!) helps. https://stackoverflow.com/help/how-to-ask – ippi May 09 '17 at 07:33
-
Also, you say "ngRoutes" so I suppose you are talking about angular-router or ngRouter. [It is NOT the same thing as Angular UI router or ui-router](http://stackoverflow.com/questions/21023763/what-is-the-difference-between-angular-route-and-angular-ui-router). **I believe it's likely that you want to use UI-router instead** https://ui-router.github.io. Check out the documentation, there are plenty! (And the usage in nwjs is identical to without nwjs.) – ippi May 09 '17 at 07:33
-
No, I am not getting any errors there is no http request in network tab. I want to use Angular UI router instead of angular-router. It works fine with angular-router html templates are loading. But, for Angular UI router templates are not loaded that is the issue. – SarvaniA May 09 '17 at 08:00
-
$stateProvider .state('login', { url: '/?contact_us', templateUrl: 'login.html', controller: 'LoginCtrl' }); – SarvaniA May 09 '17 at 08:03
-
Now that we know it's ui-router we are talking about, first I'd like to direct you to this: http://stackoverflow.com/a/20786262/1497533. Also, I think the question-mark in your URL looks a little bit suspect. (while it probably works, matching a query-parameter but naming it like a route? Hmm? Or rather, if I found this code in the wild I'd have to assume the creator must have had a good reason for doing so -- do you?) Anyway, I would try without questionmark just to get output, and you should absolutely see login.html in your networks-tab from doing this! – ippi May 09 '17 at 08:33
-
Tried without question mark but no luck. Firstly the same code works in browser when I run the application in browser only issue in nw. – SarvaniA May 09 '17 at 10:43
-
I would try a `` in your head in your main html file. But it is just guesswork at this point, so I will tell you again: if you could be bothered to post code with the problem, you'd have your answer in minutes instead of days. *"Not all questions benefit from including code. But if your problem is with code you've written, you should include some."* – ippi May 09 '17 at 12:12
-
I have tried this app.run(['$state', function ($state) { $state.transitionTo('home'); }]) – SarvaniA May 09 '17 at 12:49