小编And*_*rej的帖子

如果单击的链接与当前页面具有相同的URL,AngularJS将不刷新页面

我在我使用AngularJS的两个项目中注意到了这一点,所以我认为它是AngularJS的一个问题.

假设我在菜单上有一个"注册"按钮,然后将我带到/ account/register页面.但是,如果我在/ account/register页面上,单击该按钮将不会刷新页面.就像按钮被禁用一样.当我想要点击的链接与我当前的页面具有相同的URL时,总会发生这种情况.网址很简单<a href="something1/something2">Link</a>.如何删除此行为?

angularjs

7
推荐指数
2
解决办法
5484
查看次数

Codeigniter路由导致函数被多次调用

我的类别控制器中有一个名为“插入”的功能。当我通过像这样的 url 调用该函数时:/categories/insert 它工作正常,但如果我像这样调用该函数:/categories/insert/(末尾有斜杠)该函数将被调用三次。

即使当像这样调用我的编辑函数时:/categories/edit/2 - 编辑函数被调用三次。

在 config/routes.php 中我只有默认路由。我的 .htaccess 是这样的:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|include|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]  
Run Code Online (Sandbox Code Playgroud)

编辑:

编辑功能的代码:

public function edit($id = '') 
{
    $this->load->helper("form");
    $this->load->library("form_validation");
    $data["title"] = "Edit category";

    $this->form_validation->set_rules('category_name', 'Category name', 'required');

    if (!$this->form_validation->run())
    {
        $data['category'] = $this->categories_model->get_categories($id);
        $this->load->view("templates/admin_header", $data);
        $this->load->view("categories/edit", $data);
        $this->load->view("templates/admin_footer", $data); 
    }
    else
    {
        $this->categories_model->update($id);
        // other logic
    }
}
Run Code Online (Sandbox Code Playgroud)

php codeigniter codeigniter-routing

5
推荐指数
1
解决办法
2022
查看次数

标签 统计

angularjs ×1

codeigniter ×1

codeigniter-routing ×1

php ×1