I've created a custom property editor in 7.1.6 and I don't understand how this data is saved (and how it is store in the umbraco database) when the 'Save and Publish' button is clicked.
Do you mind sharing your code with us? It might make it a bit easier to point out how it works...but let's try and see if I can explain this properly anyway :)
When you create a property on your document type using your custom datatype/property editor then it has a model.
So if you in your view write something like {{model.alias}} it should return the chosen alias for you. If you write {{model.value}} it should return the saved value.
In your controller you tell it to use $scope and since angularjs is all about 2-way databinding you can update your model by simply writing
$scope.model.value ='I'm a text';
So when you hit save in Umbraco the value is saved in the database.
I hope this makes sense?
Some good ressources for learning angularjs and angularjs in an Umbraco context follow below.
Saving data in a custom property editor
Morning All,
I've created a custom property editor in 7.1.6 and I don't understand how this data is saved (and how it is store in the umbraco database) when the 'Save and Publish' button is clicked.
Can anyone enlighten me please?
Regards
Chris
Hi Kris
Do you mind sharing your code with us? It might make it a bit easier to point out how it works...but let's try and see if I can explain this properly anyway :)
When you create a property on your document type using your custom datatype/property editor then it has a model.
So if you in your view write something like {{model.alias}} it should return the chosen alias for you. If you write {{model.value}} it should return the saved value.
In your controller you tell it to use $scope and since angularjs is all about 2-way databinding you can update your model by simply writing
So when you hit save in Umbraco the value is saved in the database.
I hope this makes sense?
Some good ressources for learning angularjs and angularjs in an Umbraco context follow below.
https://angularjs.org/ https://github.com/umbraco/AngularWorkbook http://umbraco.github.io/Belle/#/api https://www.codeschool.com/courses/shaping-up-with-angular-js
Hi Jan,
Thanks very much for this it really helps.
I'm going to have a go at this now if I have any issues i'l post up my code.
Thanks for the resource links as well.
Cheers buddy,
Chris
I am saving selected data in json format in umbraco db. I want to retrieve the data in UI with their name. How can we do that?
Thanks in advance..
is working on a reply...