gpt4 book ai didi

javascript - AngularJS 混淆

转载 作者:行者123 更新时间:2023-12-02 18:22:29 30 4
gpt4 key购买 nike

我正在尝试最小化/混淆我的 Angular 代码,但遇到了问题。我在这里阅读“缩小说明”http://docs.angularjs.org/tutorial/step_05但我定义我的 Controller 如下

directive('itemlist', function () {
return {
restrict: 'AE',
scope: { apicall: '=', editable: '=', viewtype: '=', selectable: '=' },
controller: function ($scope, $http, $resource, $timeout, fileReader, framewidth, $dialog, errormsg) {
//Code
}
}
}

如何修改将依赖项注入(inject) Controller 的方式以使其最小化?谢谢。

最佳答案

这就是您必须定义 Controller 以使其与我的示例中的缩小器一起使用的方式

directive('itemlist', function () {
return {
restrict: 'AE',
scope: { apicall: '=', editable: '=', viewtype: '=', selectable: '=' },
controller: ['$scope', '$http', '$resource', '$timeout', 'fileReader', 'framewidth', '$dialog', 'errormsg', function ($scope, $http, $resource, $timeout, fileReader, framewidth, $dialog, errormsg) {
//Code
}
}
}

关于javascript - AngularJS 混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18702127/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com