0

I cannot get the following code to run. I have tried many many things including: $locationprovider.html5mode(true) (and a element in the of my index.html.)

With this code I get /#!/index#%2Ffishes (with my base infront of it) in my URL. With html5mode I would get #fishes but the view would not change.

Plunkr: http://plnkr.co/edit/a2lkCuxMf0ll9e9QAyiv?p=preview

Index:

<body  ng-app="VissenApp">
    <div class="AngularWrapper">
        <div ng-view>
        </div>
    </div>
</body>

App.js:

var app = angular.module("VissenApp", ["ngRoute"]);
app.config(function($routeProvider,$locationProvider) {
    $locationProvider.html5Mode(true);
    $locationProvider.hashPrefix('!');
    $routeProvider
    .when("/index", {
        templateUrl : "landing.html",
    controller: "fishesController"
    })
    .when("/fishes", {
        templateUrl : "fishes.html",
        controller: "fishesController"
    })
    .otherwise({
        templateUrl : "landing.html",
controller : "fishesController"
    });

}); 
app.controller('fishesController', function($scope,$location) {
    $scope.toFishes = function () {
        $location.path("/fishes");
    };
}); 

Fishes.html

<div class="container-fluid">
    <div class="jumbotron">
    gfhhgfh
    </div>
</div>

Landing.html

<div class="container-fluid landing_background">
    <div  id="landing_logowrapper" >
            <div  ng-click="toFishes()" id="landing_logobackground" > 
                </div>
    </div>
</div>
Kraishan
  • 443
  • 5
  • 14
  • 38

0 Answers0