Getting data in kid mandate on change of parent order?

angularjs

#1

Hi,

I know how to at first get data inside my kid mandate from the parent, by requiring the parent order in the tyke mandate and utilizing the parent controller. Be that as it may, consider the possibility that something on the parent changes and I needs a remark in the kid mandate. For instance a tick. I attempted occasions however it didn’t work. Here is my code:e of parent order:

Parent Directive:

function() {

    angular.module('app').directive('parent', parent);

    /** @ngInject */
    function parent($compile) {
        var directive = {
            link: link,
            restrict: 'EA',
            scope: {
                title: "@"
            },
            controller: parentController
        };
        return directive;

        /** @ngInject */
        function link(scope, element, attrs, ngModelCtrl) {
            element.addClass('parent-class');

            scope.collapse = function($event) {
                var container = $($event.currentTarget).parent();
                container.toggleClass('collapsed');
                if (!scope.open.firstOpen) {
                    scope.open.firstOpen = true;
                }
            };
        }

        function parentController($scope, $attrs, $element) {
            $scope.open = {
                firstOpen: false
            };
            this.open = $scope.open;
            if (typeof $attrs.open === 'string') {
                $scope.open.firstOpen = true;
            } else {
                $element.toggleClass('collapsed');
            }
        }

    }
})();

Child Directive

(function() {

    angular.module('app').directive('child', child);

    /** @ngInject */
    function child($templateCache) {
        var directive = {
            require: "^parent",
            link: link,
            restrict: 'EA',
            scope: {
                contentUrl: "@"
            }
        };
        return directive;

        /** @ngInject */
        function link(scope, element, attrs, parentController) {
            element.addClass(child-class');

            if (scope.contentUrl && parentController.open.firstOpen === true) {
                loadContent();
            }

            function loadContent() {
                var content = $templateCache.get(scope.contentUrl);
                element.prepend(content);
            }
        }

    }
})();

I need on the adjustment in the parent the tyke to think about it. Meaning when open.firstOpen turns out to be genuine I need to bring in the tyke mandate this loadContent work.

I attempted occasions, observes, however, was unsuccessful…

Thanks and Regards.
sireesha.