0

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 ?

3
  • Use a web framework like flask or django ? Commented Sep 5, 2017 at 16:27
  • But my web UI development is done in AngularJS. Will flask or django serve the purpose ? Can you show some examples ? Commented Sep 5, 2017 at 16:28
  • create your model and save it and then load it whenever needed Commented Sep 5, 2017 at 16:31

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.