I use 1.5 components, but I do not think this is important.
I am trying to make a single binding = between the parent controller and the selection area of ββthe child directives. The child's isolation area interpolates the binding literally; instead of vm.data , interpolating the data defined in the controller, literally vm.data is displayed as a string.
If I try to bind to one with @ , then again the "interpolated" value is expressed literally {{vm.data}} .
How can I get the string defined in the parent controller into the template of the child component?
angular .module('app', []) .controller('Ctrl', function () { this.str = '<0>, blah, <1>'; }) .component('appComponent', { restrict: 'E', controller: 'Ctrl as vm', template: '<div><app-str appstr-data="{{vm.str}}"></app-str></div>' }) .component('appStr', { bindings: { appstrData: '@' }, restrict: 'EA', template: function($element, $attrs) { console.log($attrs.appstrData) return '<span>'+$attrs.appstrData+'</span>'; } });
https://plnkr.co/edit/VWVlhDbhP2uDRKtXJZdE?p=preview
source share