angular-bind-polymer
angular-bind-polymer copied to clipboard
only can bind with strings?
I have had no luck trying to bind complex objects.
Does not work:
<template>
<input id="inputField" type="text" value="{{boundModel.name}}" on-click="{{setFocus}}">
</template>
where boundModel
is a object with property name.
Works:
<template>
<input id="inputField" type="text" value="{{boundModel}}" on-click="{{setFocus}}">
</template>
where boundModel
is a string.
Can you supply a PR with a test case? You can update index.html
and test/x-double.html
as needed.
Hopefully I can take a look shortly one way or another, but a test case would help considerably. Thanks!
Sure, I have the outter html test and the custom element in a couple gists:
tell you what, i will add to index and then create a new file for the custom element and make a PR. gimme a sec.
test partial: https://gist.github.com/vance/5d9d02e653c6d95833a3
custom element: https://gist.github.com/vance/71852004857f0534255d
I was looking at the ng-polymer-element implimentation, they use PathObserver instead of a watch with attribute turned on. I don't know enough about it yet, but can look into it. Maybe possible to swap the Watch with the PathObserver?
from: https://github.com/GabiAxel/ng-polymer-elements/blob/master/ng-polymer-elements.js
var observer = new PathObserver(el, propertyName);
observer.open(function (value) {
scope.$apply(function () {
if(conf.primitive) {
scope[attr] = value;
} else {
angular.copy(value, scope[attr]);
}
});
});
However, their examples are lacking and I could not get it to work with custom elements, only the paper elements.
I put the files from my testing angular app into some pull requests. I hope this helps clarify the issue!
Is this a duplicate of #1? I thought we had that fixed, but maybe it broke with newer Angular / Polymer. What versions of both are you currently using?
I don't see the PR at: https://github.com/eee-c/angular-bind-polymer/pulls. Are you sure that you made it against the correct repo?
Ah, what the heck? I know they were committed, I don't see the revision anymore though... I'll try to do it again tonight or tomorrow. I was working directly on GH for laziness, I'll pull it for real this time =)