We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

how to use angularjs ng-model within html.editor model in mvc

@Html.EditorFor(model => model.StartDate, new { ng_model = "model.StartDate" })
{{model.StartDate}}

i have to print date in client side when i change date-time picker. how can i do this? i used angularJS but i could not print the date. 

1 Reply

HP Harikrishnan P Syncfusion Team November 12, 2015 12:29 PM UTC

Hi Kssan,


Thanks for contacting Syncfusion support.


To achieve your requirement (“print the datetime, when it is changed”) you can make use of the client side events. Using the “change” event of the DateTimePicker, you can print the value as shown in the below code.



<script>

    function onChange(e) {

        $("#datetime").text(e.value);

    }

</script>



We have attached a sample for your reference, please chk it.


http://www.syncfusion.com/downloads/support/forum/121109/ze/SyncfusionMvcApplication1_(2)-1760516954


While using Razor syntax, we cannot achieve the two way binding, since to use the Angular support in our component, we need to use the directive “ej-datetimepicker”. Also we need to bind the variable to the $scope.


To know more about the Angular JS support in our components, please refer the following link


http://help.syncfusion.com/js/angularjs


Our EJMVC components are created as wrapper for the JavaScript components. So the API, and events will be the same in both JS and EJMVC components. You can refer the following API reference section present in our online JS help document to know about the list of API’s, methods and events supported by each components.


http://docs.syncfusion.com/js/api/ejaccordion


Regards,

HariKrishnan


Loader.
Live Chat Icon For mobile
Up arrow icon