Link to home
Start Free TrialLog in
Avatar of Ashwin_shastry
Ashwin_shastry

asked on

Displaying a modal pop form up from MVC controller using Angular

Hello,

I have always been a c#, .NET developer and our company is gradually transitioning to MVC and Angualr.  I am very new to MVC and Angular concepts, done a few courses about Angular and MVC on plural sight since last week and that is where I am at currently.

One the tasks I have on hand is to display a modal pop from from which needs to triggered to display from an MVC controller based on certain conditions and this modal pop up form which is a very basic form needs to be displayed using Angular.

This Modal pop up is as simple as it gets and will have a text box which needs to have an input of a 14 digit alpha numeric characters ( failure on providing it will show a validation error message on the modal pop up itself) a submit and a cancel button. On click of the submit button (after validation), the MVC controller needs to receive this value and continue its normal process.

Currently the MVC page where the modal pop up needs to be displayed has a few controls and a button. On click of this button the MVC controller calls the data access method and stores certain values in the DB. But if this 14 digit code is missing it currently throws an exception. Hence the need to for a modal popup for the user to enter the missing data.

I would very much appreciate if you can point me in the right direction by providing me some useful links or some code samples.

Thanks in advance AJ
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

I am not overly familiar with the Angular / MVC combination - the examples I have seen use MVC as the service endpoint - basically the API - but the view is handled by Angular.

I am not clear on what you are asking
One the tasks I have on hand is to display a modal pop from from which needs to triggered to display from an MVC controller based on certain conditions and this modal pop up form which is a very basic form needs to be displayed using Angular.

Are you defining your templates in MVC or Angular - can you highlight the boundaries of what each environment is in control of?

Managing a popup in Angular is very easy - you can use a service to manage it and check that the input has been filled in before any connection to the backend service is made. But to suggest how to do this is dependent on how your project is structured.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.