dart - Is there a bug in controller attribute binding -
i have parent controller , child controller , both have publishas: ctrl (the same name). if try use parameter parent-ctrl give value child-ctrl's attribute, attribute use value child-ctrl.
here example, my-ctrl1 , my-ctrl2 works expected, my-ctrl3 doesn't.
the output my-ctrl3 should be: "child3 attribute message: parent", is: "child3 attribute message: child3"
i think bug related question also: can put ng-if directive on element binds controller
ang.dart:
import 'package:angular/angular.dart'; @ngcontroller(selector: '[my-ctrl1]', publishas: 'ctrl') class myctrlcontroller { string m1="child1"; } @ngcontroller(selector: '[my-ctrl2]', publishas: 'ctrl2') class myctrl2controller { @ngoneway('message') string message; string m1="child2"; } @ngcontroller(selector: '[my-ctrl3]', publishas: 'ctrl') class myctrl3controller { @ngoneway('message') string message; string m1="child3"; } @ngcontroller(selector: '[parent-ctrl]', publishas: 'ctrl') class parentctrlcontroller { string m1="parent"; } class myappmodule extends module { myappmodule() { type(myctrlcontroller); type(myctrl2controller); type(myctrl3controller); type(parentctrlcontroller); } } void main() { ngbootstrap(module: new myappmodule()); } ang.html:
<!doctype html> <html ng-app> <head> <meta charset="utf-8"> <title>ng-model test</title> <link rel="stylesheet" href="ang.css"> </head> <body> <div parent-ctrl> <p>parent m1: {{ctrl.m1}}</p><br> <div my-ctrl1> <p>child1 m1: {{ctrl.m1}}</p><br> </div> <div my-ctrl2 message="ctrl.m1"> <p>child2 attribute message: {{ctrl2.message}}</p> <p>child2 m1: {{ctrl2.m1}}</p><br> </div> <div my-ctrl3 message="ctrl.m1"> <p>child3 attribute message: {{ctrl.message}}</p> <p>child3 m1: {{ctrl.m1}}</p> </div> </div> <script src="packages/shadow_dom/shadow_dom.min.js"></script> <script type="application/dart" src="ang.dart"></script> <script src="packages/browser/dart.js"></script> </body> </html>
Comments
Post a Comment