javascript - "No file found" keeps occurring while using $redirectRoute -


my objective have 1 of links on page redirect page on website.

here 1 of 2 links on index.html page:

<html ng-app="myapp">        .        .        . <body>     <h1>my home page</h1>         <div>             <a href="login/google" class="button">sign in google</a>             <a href="login/facebook" class="button">sign in facebook</a>         </div> <div ng-view></div> <hr/> 
  • when "sign in facebook" link clicked. redirects page. have set using 'routeprovider' have given below. inside file called 'routes.js'. now problem when clicked, page opens displays 404 error. console says there "no file found for: /login/facebook/"

    'use strict';  myapp.config("$routeproviders", function($routeprovider) {     $routeprovider     .when('login/google', {      })     .when("login/facebook", {         templateurl: '/partials/login/facebook_login.html',         controller: 'facebookloginctrl'     })     .otherwise({         redirectto: '/'     }); }); 
  • inside facebook.html page in '/partials/login' directory have:

    <h1>{{name}}</h1> <button ng-click="fblogin()">facebook login</button> 
  • and facebookloginctrl in file called sign_in_controllers.js:

    'use strict';      myapp.controller('facebookloginctrl', ["$scope", function($scope) {     $scope.name = 'login please'; }]); 

also app.js file:

    var myapp = angular.module('myapp', ['ui.bootstrap', 'ngroute']); 

i don't understand why getting no file found error when have file located inside '/partials/login/'

by default angular routers use hash based paths within app.

unless use html5mode , configure server need include hash in link href

<a href="#/login/google" class="button">sign in google</a> <a href="#/login/facebook" class="button">sign in facebook</a> 

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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -