templateUrl angularjs routerProvider for Codeigniter
I'm new in angularjs. How to pass my templateUrl routerProvider angularjs in my Codeigniter application.
For example my codeigniter controller is:
class Tester extends CI_Controller {
function __contruct();
{
parent::__contruct();
}
function index()
{
$this->load->model('m_tester');
$data['title'] = 'Home';
$this->load->view('tester/template',$data);
}
}
and here is my controller to create my json data, still in one controller file:
function studentlist()
{
$this->load->model(array('m_tester'));
$data = $this->m_tester->studentlist();
$this->output->set_content_type('application/json')->set_output(json_encode($data));
}
the json output is work well when I access my page in because my homepage for tester page is to display studentlist() controller without routerProvider.
and here is my view folder and file in codeigniter:
cbt
-application
--views
---tester
I have menu file in views tester folder, it's menu.php:
switch($title)
{
case 'Home';
include 'home.php';
break;
}
so my question is how to pass my templateUrl in my angularjs routerProvider config for my codeigniter?
var myApp = angular.module('myApp', ['ngRoute']);
myApp.config(function($routerProvider, $locationProvider){
$routerProvider
.when('/', {
templateUrl: '**<--I'M STILL CONFUSED HERE-->**',
controller: 'studentController'
});
$locationProvider.html5Mode(true);
});
链接地址: http://www.djcxy.com/p/77622.html