I'm encountering an issue binding from angular to Polymer 1.0.
Here is my custom element that has a single property named myprop:
<dom-module id="my-custom-element">
<template>
<span>{{myprop}}</span>
</template>
</dom-module>
<script>
Polymer({
is: 'my-custom-element',
properties: {
myprop: String
},
ready: function () {
var p = this.myprop; //why is p set to "{{testfield}}" and not "Hello!"?
}
});
</script>
Here is the HTML:
<div ng-app="myApp">
<div ng-controller="myCtrl">
<my-custom-element myprop="{{testfield}}"></my-custom-element>
</div>
</div>
And here is the angular controller:
<script>
angular.module("myApp", ["my.directives"]).controller("myCtrl", function ($scope) {
$scope.testfield = "Hello!";
});
</script>
In the Polymer ready function why is the variable p set to the string "{{testfield}}"? I would expect it to have value "Hello!". Note that the custom element is actually displaying the text "Hello!" so it looks like the binding in the custom element template is working as expected. But I don't understand why the bound-to value isn't available in the ready function.