javafxwebview icon indicating copy to clipboard operation
javafxwebview copied to clipboard

How can i use ngRoute?

Open micro24 opened this issue 8 years ago • 4 comments

Hi thank you for your project , how can i use ngRoute in this project, for example i have a page and i want switch to another page, i can use my controller , i wrote below code for access ng route but i could not. var approute = angular.module("myApp", ["ngRoute"]);

approute.config(function($routeProvider) { alert('$routeProvider'); $routeProvider .when("/", { templateUrl : "index.html" }) .when("/red", { templateUrl : "red.html" }) .when("/green", { templateUrl : "green.html" }) .when("/blue", { templateUrl : "blue.html" }); });

please guidance me for using route in this project.

Best Regards

micro24 avatar Mar 24 '17 22:03 micro24

I have tested it and it works. But you need to add angular-route.js in the index.html (you will need to download it, or reference it to an external URL). For example:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js" type="text/javascript"></script>

Remove the current <script src="jslib/angular.min.js" type="text/javascript"></script> line in index.html.

You will also need to add a <div ng-view></div> in the index.html to place the contents of the view.

lipido avatar Mar 25 '17 08:03 lipido

Hi Thank you for your answering, i write such as you, but it does not work, how can i debug HTML in javafx?for finding my problem.

Best Regards

micro24 avatar Mar 25 '17 09:03 micro24

It is not easy to debug. By now, my code prints in the console all your calls to "alert" and angular exceptions, but nothing more. :-(

lipido avatar Mar 25 '17 11:03 lipido

Thank you, yes i do with your alert in controller but in ngRoute( alert('$routeProvider')) does not work, maybe can not find or call approute.config(function($routeProvider) .

micro24 avatar Mar 25 '17 11:03 micro24