search

Home  >  Q&A  >  body text

angular.js - AngularJs Component() 没有执行

项目基于 AngularJs 1.5.8 版本开发。
在使用 component() 时遇到问题:组件没有执行。

我的代码如下:

define(['angular','app'],function (angular,app) {
    var departmentSelector = {
        bindings: {
            option: '='
        },
        templateUrl: 'dist/component/department-selector/index.html',
        controller: DepartmentSelectorController,
        controllerAs: 'vm'
    };

    app.component('departmentSelector', departmentSelector);

    DepartmentSelectorController.$inject  = ['$filter'];
    function DepartmentSelectorController($filter) {
        console.log("执行 组件 departmentSelector 成功");
    }
});
天蓬老师天蓬老师2744 days ago463

reply all(1)I'll reply

  • 阿神

    阿神2017-05-15 17:13:23

    I also encountered the same problem, I don’t know if you solved it. Initially, the first request was executed, but after refreshing, the component failed and the view was not displayed

    reply
    0
  • Cancelreply