locked
DataAnnotations with TypeScript/Angular 2 RRS feed

  • Question

  • We have a number of Models with validation enforced via the DataAnnotation tags.  Example:

               [Required(AllowEmptyStrings = false, ErrorMessage = "Username is required")]

        public string UserName

    We are now developing a .NET Core application with Angular 2 and would like to continue to use the Models and the validation they bring.  The edits should be enforced on the "Client" as opposed to requiring a postback to get the validation errors.  Knockout has been used previously to implement this requirement.  But, I just want to use Angular 2 or TypeScript to implement the client-side edits.  Can this be done and could you please provide some examples of how to do it? 


    • Edited by DaveIII Friday, December 16, 2016 4:42 PM typo
    Friday, December 16, 2016 4:41 PM

Answers

  • Hi Dave,

    This forum is discussing Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    Your issue is related to ASP.NET development, I think you should re-post this thread to the following site for a professional answer, thank you very much:

    https://forums.asp.net/1255.aspx/1?ASP+NET+Core

    Sincerely,

    Oscar


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Oscar_Wu Tuesday, December 20, 2016 1:29 AM
    • Marked as answer by DaveIII Tuesday, December 20, 2016 4:33 AM
    • Unmarked as answer by DaveIII Tuesday, December 20, 2016 4:33 AM
    • Marked as answer by DaveIII Tuesday, December 20, 2016 4:33 AM
    Monday, December 19, 2016 5:22 AM