Comments (3)
change render in view object to
render: function(){
if(typeof this.view.format != 'string') {
this.view.$root = this.view.format;
this.view.format = this.view.format.html();
}
else if (this.view.$root.size() === 0) {
this.view.$root = $(this.view.format);
}
else {
this.view.$root.html( $(this.view.format).html() ); // can't overwrite $root as this would reset its presence in the DOM and all events already bound, and
}
return this;
}
and change
if (typeof args[1] === 'object') {
if(args[1].format)
$.extend(object.view, args[1]);
else
object.view.format = args[1];
}
from agility.
k, some basic stuff seem to work after a tweak to handle empty objects passed as the 'view' argument in the $$ constructors.
In render function:
if(typeof this.view.format != 'string' && !$.isEmptyObject(this.view.format)) {
this.view.$root = this.view.format;
this.view.format = this.view.format.html();
}
else if (this.view.$root.size() === 0) {
this.view.$root = $(this.view.format);
}
and
if (typeof args[1] === 'object') {
if(args[1].format || $.isEmptyObject(args[1]))
$.extend(object.view, args[1]);
else
object.view.format = args[1];
}
Will check more thoroughly as I implement code using the tweak.
from agility.
The view binding works great.
But if I did something like
<div class="agility article"><p data-bind="content">Lorem Ipsum</p>
And create the agility object using the above code, the model doesn't reflect the values, i.e.
article.model.get("content") is undefined
Is there a way to load the model from the DOM when the object is initialized?
from agility.
Related Issues (20)
- model->DOM for radio doesn't check the radio at load of the page
- Appending to a new container doesn't fully remove from former parent container
- How to bind a subproperty? HOT 1
- More info in model change event HOT 4
- Zero value in model is not visible HOT 1
- data-bind with class should not clobber the agility class of root element HOT 2
- Append html element to parent containers view context
- Serialize agility object HOT 3
- Data binding default model values on first initialization HOT 1
- [enhancement] Add missing bower.json.
- Wrap agility around an existing DOM container/element
- feature request
- Is this project being maintained/branched elsewhere? HOT 4
- Is it possable to add if judgement,just like [ng-if].
- Is it possable to add repeat function and repeat callback,just like [ng-repeat].
- agilityjs.com was shutdown HOT 2
- COPYRIGHT INFRINGEMENT
- Unable to extend 'user_defined_property' when extending an existing prototype using $$()
- Multiple binds? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agility.