При изменении значения selectedWidget.id наблюдатель не обнаружил изменения.
Этот наблюдатель:
наблюдатели: ['functionOberveId (selectedWidget.id)'],
Код hola-mundo.html:
<link rel="import" href="./bower_components/polymer/polymer.html">
<link rel="import" href="./hidding-behaviour.html">
<dom-module id="hola-mundo">
<style>
h1{
color: blue;
}
</style>
<template>
<h1>hello world</h1>
<button on-click="changeValuebahviourId">changeValuebahviourId</button>
<button on-click="showValuebehaviourId">showValuebahviourId</button>
</template>
<script>
Polymer({
is: "hola-mundo",
behaviors: [Hidding],
observers: ['functionOberveId(selectedWidget.id)'],
functionOberveId: function(){
console.log("the observer is working fine")
console.log("the id value in behaviour is: " + this.selectedWidget.id)
},
changeValuebahviourId: function(){
this.selectedWidget.id= (this.selectedWidget.id +1)
},
showValuebehaviourId: function(){
console.log("the id value in behaviour is: " + this.selectedWidget.id)
},
});
</script>
</dom-module>
Код hidding-поведениеiour.html:
<script>
Hidding = {
properties:{
selectedWidget: {
type: Object,
value: {
item: null,
id: 0,
},
},
},
}
</script>
Код index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Prueba de index</title>
<script src="./bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="./hola-mundo.html">
</header>
<body>
<hola-mundo></hola-mundo>
</body>
</html>
Почему наблюдатель не стреляет, когда мы нажимаем кнопку "changeValuebahviourId"?
Буду признателен за помощь в этом, для которого я просматривалдолго и не могу найти решение.
Спасибо большое.