angularjs html5 mode pretty url not working -


i doing angularjs application generated web storm. tried use html5 model pretty url (without # on url).it not working.the url # working fine. here workouts app.js

var app = angular.module('myapp', [     'ngroute',     'ngcookies',     'myapp.login',     'myapp.services',     'myapp.authenticationservice',     'headroom',     'angular-loading-bar',     'angularsoundmanager',     'updatemeta' ]).     config(['$routeprovider','$locationprovider', function ($routeprovider,$locationprovider) {         $routeprovider.when('/login', {templateurl: 'user/login.html', controller: 'loginctrl'});         $routeprovider.when('/view2', {templateurl: 'partials/partial2.html', controller: 'myctrl2'});         $routeprovider.otherwise({redirectto: '/login'});         // configure html5 links working on node-webkit         if(window.history && window.history.pushstate){             //$locationprovider.html5mode(true); cause error $location in html5 mode requires  tag present! unless set baseurl tag after head tag so: <head> <base href="/">              // know more setting base url visit: https://docs.angularjs.org/error/$location/nobase              // if don't wish set base url use             $locationprovider.html5mode({                 enabled: true,                 requirebase: false             });         }     }]) 

index.html head section

<head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <title>myapp</title>     <meta name="description" content="">     <meta name="viewport" content="width=device-width, initial-scale=1">     <link rel="shortcut icon" href="content/images/favicon.png" type="image/x-icon"/>     <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">     <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">     <link rel="stylesheet" href="app.css">     <link rel="stylesheet" href="bower_components/angular-loading-bar/build/loading-bar.min.css">     <script src="bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>     <base href="/"> </head> 

login.js

'use strict';      angular.module('myapp.login', ['ngroute'])         .controller('loginctrl', ['$scope', '$location', '$http', 'myappsettings', 'apiservice','authenticationservice', function ($scope, $location, $http, myappsettings, apiservice,authenticationservice) {             (function initcontroller() {                 alert('d');                 // reset login status                 //authenticationservice.clearcredentials();             })();             function _login(username, password) {                 authenticationservice.login(username, password, function (response) {                     if (response.success) {                       } else {                         alert('error')                     }                 });              }             $scope.login=_login;         }]); 

can please help?thanks in advance.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -