How can i use ngRoute?
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
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.
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
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. :-(
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) .