zoukankan      html  css  js  c++  java
  • [AngularJS] Extend Controller

    /**
     * Module definition and dependencies
     */
    angular.module('App.Child', [])
    
    /**
     * Component
     */
    .component('child', {
      templateUrl: 'child.html',
      controller: 'ChildCtrl',
    })
    
    /**
     * Controller
     */
    .controller('ChildCtrl', function($controller, $parentDep) {
    
      //Get controllers
      const $ctrl = this;
      const $base = $controller('ParentCtrl', {$parentDep});
    
      //Extend
      angular.extend($ctrl, $base);
    
      /**
       * On init
       */
      this.$onInit = function() {
    
        //Call parent init
        $base.$onInit.call(this);
    
        //Do other stuff
        this.somethingElse = true;
      };
    });
  • 相关阅读:
    consumer详解
    消费幂等
    死信队列
    消息重试
    负载均衡
    存储层
    producer消息
    消息发送与接收
    TCC
    form表单提交前进行加密
  • 原文地址:https://www.cnblogs.com/Answer1215/p/11477294.html
Copyright © 2011-2022 走看看