2017-02-19 3 views
-2

Ich bin ein Anfänger AngularJs und arbeite derzeit an einem kleinen Testprojekt. Ich fand heraus, dass die App in Firefox einwandfrei funktioniert, aber nicht in IE 11 und Chrome. Ich habe die meisten Fehler im Internet versucht. das Hinzufügen von Meta-Tags und alle, aber keine von ihnen, funktionierte für mich. Hier ist mein Code.AngularJs ng-route funktioniert nicht in IE 11

-Code

'use strict'; 
 
var app = angular.module("myApp", ['ngRoute']); 
 

 
app.config(['$routeProvider', function($routeProvider) { 
 
    $routeProvider.when('/', { 
 
    templateUrl: 'home.html', 
 
    controller: 'HomeCtrl' 
 
    }); 
 
    $routeProvider.when('/services', { 
 
    templateUrl: 'services.html', 
 
    controller: 'ServicesCtrl' 
 
    }); 
 
    $routeProvider.when('/clients', { 
 
    templateUrl: 'clients.html', 
 
    controller: 'ClientsCtrl' 
 
    }); 
 
    $routeProvider.otherwise({redirecTo: '/'}); 
 
}]); 
 

 
app.controller('HomeCtrl', ['$scope', function($scope){ 
 
    $scope.message = 'Welcome to Inspire'; 
 
}]); 
 

 
app.controller('ServicesCtrl', ['$scope', function($scope) { 
 
    $scope.message = 'Everyone come and see how good I look!'; 
 
}]); 
 

 
app.controller('ClientsCtrl', ['$scope', function($scope) { 
 
    $scope.message = 'These are clients'; 
 
}]);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> 
 
<!DOCTYPE html> 
 
    <html> 
 
    <head> 
 
    <link rel="stylesheet" href="style.css" /> 
 
    <script src="app.js"></script> 
 
    </head> 
 
    <body ng-app="myApp"> 
 
    <ul> 
 
    <li> 
 
    <a href="#/">Home</a> 
 
    </li> 
 
    <li> 
 
    <a href="#/services">Services</a> 
 
    </li> 
 
    <li> 
 
    <a href="#/clients">Clients</a> 
 
    </li> 
 
    </ul> 
 
    <div ng-view=""></div> 
 
    </body> 
 
    </html>

+0

Versuchen

Verwandte Themen