eee-c / angular-bind-polymer Goto Github PK
View Code? Open in Web Editor NEWAngular directive for *double* variable binding of Polymer attributes.
License: MIT License
Angular directive for *double* variable binding of Polymer attributes.
License: MIT License
I was creating some POCs around angular and polymer and wanted to have two-way data binding working between them. However, two-way binding did not work with my POC. I have installed angular-bind-polymer separately and tried with the demo index page you have created. Binding is not working with demo page as well. What am I doing wrong here?
The directive is not working for polymer property name with came casing. probably need to rewrite the regex again var match = $attr[prop].match(/{{\s([.\w]+)\s_}}/);
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.
It seems that when passing an object via attribute to polymer element the tow way data binding not working. Here is a link to SO:
http://stackoverflow.com/questions/24340258/angular-polymer-data-binding
Binding is not working when directive uses transcluding. For example ng-repeat or custom directive.
Do you know the way how to solve this problem?
Looks like observers don't exist any longer.
When there are multiple bind-polymer
attributes only when the first input will update the other inputs would update.
When I use the bind polymer directive on elements hidden with ng-if and for example indirectly via ui-router, I get the following exception:
TypeError: Cannot read property 'match' of undefined
at link (http://localhost:8080/bower_components/angular-bind-polymer/angular_bind_polymer.js:11:43)
at Z (http://localhost:8080/bower_components/angular/angular.min.js:70:149)
at A (http://localhost:8080/bower_components/angular/angular.min.js:59:203)
at g (http://localhost:8080/bower_components/angular/angular.min.js:51:299)
at A (http://localhost:8080/bower_components/angular/angular.min.js:59:147)
at $get.c (http://localhost:8080/bower_components/angular/angular.min.js:66:333)
at g (http://localhost:8080/bower_components/angular/angular.min.js:51:299)
at http://localhost:8080/bower_components/angular/angular.min.js:50:415
at $get.h (http://localhost:8080/bower_components/angular/angular.min.js:52:283)
at l (http://localhost:8080/bower_components/angular/angular.min.js:56:293)
I have added scope to the directive like below.
angular.module('angularBindPolymer', []).
directive('bindPolymer', function() {
return {
restrict: 'A',
scope: {change: "="}, // Scope added here
link: function(scope, element, attrs) {
.........
}
}
After I added the scope, the two way bind stopped working. If I remove scope then everything is back to normal.
Please make demostration
This scenario will show blank pre elements?
<paper-input label="test" floatingLabel bind-polymer value="{{test}}" inputValue="{{testing}}">
</paper-input>
<pre>{{test}}</pre>
<pre>{{testing}}</pre>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.