首页 > 解决方案 > Angular 6 的代码点火器

问题描述

我想在使用 angular 6 的应用程序中使用 Code Igniter 的控制器和模型。

我的计划是:

  1. 前端使用 Angular 6
  2. 使用 CI 的控制器将数据发送到模型,然后模型将数据发送到数据库。
  3. 将应用程序的文件夹(代码点火器文件夹)除了我的角度应用程序的资产中的视图。
  4. 当我想做数据库事务时使用那个控制器。

我的问题是:

  1. 这行得通吗?
  2. 有缺点吗?

在发布此 OP 期间仍在开发我的应用程序。

auth.service- 提交表单时调用

getUserDetails(username,password){
    //post details to API server return info if correct
    return this.http.post<myData>('/api/auth.php',{
      username,
      password

    })
  }

这是我将数据传递到控制器和控制器中的方式

我应该:

public function login()
    {
        $this->form_validation->set_rules('username','Username','trim');
        $this->form_validation->set_rules('password','Password','trim|callback_authentication');

        if($this->form_validation->run() == FALSE)
        {
            $this->index();
        }
        else
        {
            redirect('Home');
        }
    }

我应该如何修复return this.http.post<myData>('/api/auth.php',{才能调用函数登录?

标签: phpmysqldatabaseangularcodeigniter

解决方案


推荐阅读