How to route CodeIgniter with Angular.js? : <p>I'm trying to use Angular.js and CodeIgniter together. </p>

<p>With <code>ngRoute</code> in my app, I'm setting in my <code>main.js</code>:</p>

<pre><code>$locationProvider.html5Mode(true);

$routeProvider.when('/test', {
    templateUrl: 'partials/test.html'
});

$routeProvider.otherwise({
    templateUrl: 'partials/home.html'
});
</code></pre>

<p>In my <code>routes.php</code>, I'm setting:</p>

<pre><code>$route['default_controller'] = 'home';
$route['(:any)'] = "home";
</code></pre>

<p>And in my <code>home/index.php</code>, I have the <code>&lt;ng-view&gt;&lt;/ng-view&gt;</code>.</p>

<p>The thing is, <strong>without</strong> the <code>html5Mode(true)</code> (with /#/ on the URL) everything works fine. But otherwise, the partials file works, but the page reloads anyway.</p>

<p>In Inspector Elements, things look like this:</p>

<p><a href="https://i.stack.imgur.com/lSwQ3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lSwQ3.png" alt="partials/test.html loaded, but the page realoded, and the error &quot;ngView: undefined&quot; showed up"></a></p>

<p>partials/test.html loaded, but the page realoded, and the error "ngView: undefined" showed up.</p>

<p>I'm still learning Angularjs. Anyone can help?</p>
