![]() binding can be done in the html view just by having the same ng-model.Wherever the tag is placed, the new control is created. the controller doesn’t need to know about the ids of the html.While there is a bit of code for the setup of the control and the directive, we gain some nice things: Be sure to open in Chrome or Firefox since the cdn version of OpenUI5 doesn’t work well with IE. In the jsbin example I’ve also added a filter to format the date. We’ve even added a custom attribute to set the locale as shown for the start date.Ĭheckout the live example on jsbin. Setup the binding on the Angular change of a modelĪll that’s left is to add the datepicker to our html.Setup the binding on the change of the datepicker.Setup the OpenUI5 datepicker and initialize with the model and some attribute tags.Angular setup to tell it to link to an element and use the model passed into the element.Then we create an Angular directive and initialize the datepicker. In the controller the model is plain old javascript: Once we have the directive we can re-use it very easily in our html.įirst is the Angular controller. Directives are a way to extend html new tricks and is also how we can use Angular models to bind data. To produce an OpenUI5 datepicker and then just use the curly braces to show the information somewhere else:Īngular can help us do this with its concept of directives. Wouldn’t it be nice if we could use Angular model binding with OpenUI5 controls? What if we could also include OpenUI5 controls such as the datepicker directly in our html using some custom tags? There are similar templating options in OpenUI5 so we can do something almost the same without livebinding by using handlebars:Īlong with just a bit of model binding in javascript (see the live examples). Something similar in Angular can be done directly in the html: First in UI5 based on the OpenUI5 sap sdk example: Let’s look a bit behind the scenes at how to code them. Here’s two input fields beside some text. ![]() Let’s compare some of the features of the two frameworks. AngularJS is a great javascript library that can also add a lot of power to your application. SAPUI5 has just been open sourced as OpenUI5 and provides a lot of features.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |