How to integrate ASP.NET MVC Core with Vue.js?

1

I have a project that requires the client side to use Vue.js to render application views, but on the server side it is intended to use ASP.NET MVC Core to validate all business rules.

Is there a way to integrate both technologies?

    
asked by anonymous 14.08.2017 / 19:09

2 answers

0

Hello, one way would be to use asp.net core to serve as a rest api, and use the vues only for a front end, in my opinion is the best way.

    
15.08.2017 / 20:41
0

The simplest and least "malicious" way is to pass the object's JSON to the view.

For example:

<script>
        var app = new Vue({
            el: '#clienteForm',
            data:  @Json.Serialize(Model)
        })
</script>

Now your object Vue has all the model data

The other option is to make your vue do ajax requests for a WebAPI that returns the object's JSONs.

    
08.12.2017 / 17:30