簡體   English   中英

使用Codeigniter時如何在有角UI路由器中提及模板URL?

[英]How to mention template url in angular ui-router when using codeigniter?

我已經使用角度ui-router路由了我的應用程序,按照每個codeigniter文件結構,視圖文件放置在application-> views文件夾中。 腳本文件放置在資產->腳本文件夾中。 我無法路由到視圖文件。

只需將狀態下的templateUrl設置為codeigniter控制器方法的url,以便它返回視圖。

一個使用codeigniter視圖示例的示例

// codeigniter controller
<?php
class Blog extends CI_Controller {

        public function index()
        {
            // get the blog view
            $this->load->view('blogview');
        }
}

和您的AngularJS狀態:

$stateProvider
.state('blog', {
    // other state parameters
    ...
    // this will get the view returned from your index method in your Blog controller
    templateUrl: '/index.php/blog/',
    ...
    // other state parameters
});

它將對模板的GET請求發送到codeigniter控制器中的index方法,該方法將返回視圖。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM