具有角度6的代码点火器

I want to use Code Igniter's Controller and Model in my application that uses angular 6.

My plan is:

  1. use angular 6 for the front end
  2. use CI's controller to send data to Model which then sends data to database.
  3. put the folders of Application(Code Igniter folder) except the view inside assets of my angular application.
  4. use that controllers when I want to do database transaction.

My questions is:

  1. Will this work?
  2. Are there drawbacks?

Still developing my application during posting of this OP.

auth.service - this is called when form is submitted

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

    })
  }

this is my way to pass my data into my controller and in my controller

I should have:

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');
        }
    }

How should I fix return this.http.post<myData>('/api/auth.php',{ so that I can call the function login?