Regressor
Regressor

Reputation: 1973

Calling a back end python script from Angular 2 front end

I have a web page in Angular 2 with a submit button(for simplicity). I want to call Python code when this submit button is hit. The python code is meant to perform some Machine Learning algorithm and return some response.

Can you please give me some inputs on this ?

Upvotes: 0

Views: 2725

Answers (1)

Marco Rosas
Marco Rosas

Reputation: 91

The produced JS/HTML from an Angular2+ project is client-side code only. I understand there is not a direct way to execute backend instructions. You will need a middle layer, most likely in an API form. The Angular2+ application can make a request to this API, and your backend handles it.

It is the same concept of trying to access a DB directly from an ng2 application:

Connect database in Angular 2

Upvotes: 1

Related Questions