angular-component icon indicating copy to clipboard operation
angular-component copied to clipboard

one-way binding not working?

Open linkedrank opened this issue 8 years ago • 1 comments

Hello -

I'm trying to use this angular-component.js with angular 1.4.14 for this component: https://github.com/pablojim/highcharts-ng

Its scope is two one-way bound variables. If you see the code below, when run, the variable config is just not defined in the controller when it goes to add the method getChartObj. In addition, the modifiedBindings variable in this case in your code works out to be {}. It works if I change the binding for the two variables to =.

Any ideas?

  angular.module('highcharts-ng', [])
    .component('highchart', {
        bindings: {
            config: '=',
            changeDetection: '='
            //config: '<',
            //changeDetection: '<'
          },
          controller: HighChartNGController
    });

  HighChartNGController.$inject = ['$element', '$timeout'];

  function HighChartNGController($element, $timeout) {
    var seriesId = 0;
    var ctrl = this;
    var prevConfig = {};
    var mergedConfig = {};
    var detector = ctrl.changeDetection || angular.equals;
    this.$onInit = function() {
      ctrl.config.getChartObj = function(){

linkedrank avatar Apr 12 '17 22:04 linkedrank

There's a pull-request for this already, #39 . Any thoughts on this @toddmotto ? This polyfill is great for us stuck in 1.4 land a little longer, thanks for creating it!

toxaq avatar Jun 13 '17 03:06 toxaq