473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Infinite redirection in AngularJS

Dipen Mehta
I am implementing AngularJS for redirection in Codeigniter project but it's cause infinite redirection. My Directory and file structure is as under:
Expand|Select|Wrap|Line Numbers
  1.     application
  2.         controllers
  3.             admin
  4.                 home.php
  5.         view
  6.             admin
  7.                 home
  8.                     index.php
  9.                 listing
  10.                     index.php
  11.                 theme
  12.                     header.php
  13.                     footer.php
  14.                     index.php
  15.     system
AngularJS CODE:

Header.php

Expand|Select|Wrap|Line Numbers
  1. <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
  2. <script>
  3.     var sampleApp = angular.module('sampleApp', []);
  4.  
  5.  
  6.     sampleApp.config(['$routeProvider', '$locationProvider',
  7.         function($routeProvider, $locationProvider) {
  8.             $locationProvider.html5Mode(true);
  9.             $routeProvider.
  10.                 when('/angular/ci/admin/home/', {
  11.                     templateUrl: 'home'
  12.                 }).
  13.                 when('/angular/ci/admin/home/listing/', {
  14.                     templateUrl: 'home/listing'
  15.                 }).
  16.                 otherwise({
  17.                     redirectTo: '/angular/ci/admin/home/'
  18.                 });
  19.         }
  20.     ]);
  21. </script>
  22.  
  23. <div>header</div>
  24.  
  25. <div>
  26.     <a href="http://localhost/angular/ci/admin/home/">Home</a>&nbsp;&nbsp;&nbsp;
  27.     <a href="http://localhost/angular/ci/admin/home/listing/">Listing</a>
  28. </div>
theme/index.php

Expand|Select|Wrap|Line Numbers
  1. <div ng-app="sampleApp">
  2.     <?php
  3.         $this->load->view(ADMIN_THEME."header.php");
  4.     ?>
  5.     <div class='ng-view'>
  6.         <?php
  7.             $this->load->view('admin/'.$pagename);            
  8.         ?>
  9.     </div>
  10.     <?php
  11.         $this->load->view(ADMIN_THEME."footer.php");
  12.     ?>
  13. </div>
controllers/home.php

Expand|Select|Wrap|Line Numbers
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Home extends CI_Controller {
  4.     public function index(){
  5.         $data['pagename']='home/index';
  6.         $this->load->view(ADMIN_THEME.'index',$data);
  7.     }
  8.     public function listing(){
  9.         //echo 'hi';
  10.         $this->load->view('admin/listing');
  11.  
  12.     }
  13. }
Jan 17 '15 #1
0 1126

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Edwin G. Castro | last post by:
I want to start a process from a C# application. I also want to redirect standard error to standard output so that I can read output from both streams just like I could from a command line. In...
0
by: headware | last post by:
I have a question about how best to implement a redirection to a framed version of a web site. Basically I have a web site that was originally implemented without frames. Then it was decided that...
2
by: Larry | last post by:
I have a requirement to redirect to a pre-defined landing page if the session times out. I'm able to trap when the session time's out, however, I am unable to redirect. The software seems to go...
2
by: Mitul | last post by:
Hello friends. I have some problem while submitting page. The alert will popup and display following message. So Please help me as soon as possible. I am not able to submit the page due to this....
8
by: graphicsxp | last post by:
Hi, I'm trying to figure out the best way to redirect the user to a special page when in my code i'm trying to use a Session object and that one is nothing. Oviously I could do: if...
7
by: iaesun | last post by:
hello, this post assumes executing a program with file redirection as follows: program.exe < intput.txt where input.txt is a text file where there is not necessarily any whitespace after...
1
by: Sleepwalker | last post by:
Hi, I'm currently in the process of constructing a stripped down version of the company website that will be show to people logging in from a mobile device. When the user logs in to the homepage,...
1
by: cgautier | last post by:
Hi, I've written a podcast retriever app that uses HttpWebRequest.Create (URL), httpWebRequest.GetResponse() and httpWebResponse.GetResponseStream() to retrieve podcast (.mp3) files from various web...
0
by: mrkvngrkn | last post by:
Hi, I am going to build a social intranet for a company with about 750 employees. They already use WordPress with the BuddyPress plugin. Also, they have multiple internal systems which would have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.