Posts

Showing posts from August, 2013

KnockOut JS – Part 2

In Previous blog, explained about Observables, ComputedObservables, observableArray, Sunscribing. Bindings: Built in Bindings Text and Appearances (visible, text, html, css, style, attr) Form elements (click, event, submit, enable, disable, value, checked, options, selectedOptions, uniqueName) Control Flow (if, ifnot, foreach, with) Templates (Tradition JavaScript template in <script> tag, Template-less, comment-based syntax [Anonymous Templates]) As like HandleBars.js, the KnockOut.js is supporting templates. We should not do foreach in ViewModel, it should be done in UI. So that the template data already bonded will not be bonded again. KnockOut.js will work without any external references like (JQuery) Instead of using <script> Templating, Knockout.Js is providing comment tags to do the same. Eg: <!—ko.foreach:tags à <!-- /ko à To delete the particular row in client side we can use ko.datafor(this); Parent Binding Context...

KnockOut JS – Part 1

KnockOut.js and MVVM: http://knockoutjs.com/ KnockOut.js file used for client side binding and used for client MVVM pattern designs. Knockout: Features Rich client-side interactivity MVVM like pattern Wide browser Support Key Concepts Dependency tracking via observables Var myviewModel = { firstName: ko.observable("John") }; Declarative bindings <input data-bind="Value: firstName" /> Templating Support Ko.applyBindings(myviewModel); Observables(ko.observable()) Both sides(UI and Object) are updated while change the value ComputedObservables Used to calculate a value based on the input Read/write computed observableArray functions : destroy, destroyAll, indexOf, pop, push, remove, removeAll, reverse, shift, slice, sort, splice, unshift Subscribing to changes Register to be notified when changes occur Similar to setter property in .Net Useful when you need to take action wh...

LESS Style Sheet

LESS style sheet - http://lesscss.org/index.html The CSS values like colors and width can be set through variables. Also LESS have lot of features like Mixins, Nested Rules, Functions & Operations. This LESS style sheet will be compiled and create the real CSS.