将Angular 1脚本转换为角度2

时间:2017-09-11 16:05:03

标签: javascript angular

我有用角度1编写的代码,我需要将其转换为角度2 我的所有其他角度脚本都是用角度2写的。

(function() {
'use strict';

angular
    .module('myApp', [])
    .controller('testCtrl', testCtrl);

testCtrl.$inject = ['$scope'];

function testCtrl($scope) {
    $scope.categoryTypes = ['M-Trouser-Denim ','M-Trouser-Cotton','M-T shirt-Cotton','M-T shirt-Silk','M-T shirt-Polyester','M-Shirt-Cotton','M-Shirt-Silk','M-Shirt-Polyester','M-Short','Blouses','Skirts','Saree','FM-Trouser-Denim','FM-Trouser-Cotton','FM-T shirt-Silk','FM-T shirt-Polyester','FM-Shirt-Cotton','FM-Shirt-Silk','FM-Shirt-Polyester','FM-Short'];

    $scope.clothCount = ['1','2','3','4','5','6','7','8','9','10']


    $scope.itemSet = {
        item: []
    };

    $scope.addNewItem = function() {
        $scope.itemSet.item.push({});
    };

    $scope.removeItem = function(index) {
        $scope.itemSet.item.splice(index, 1);
    };
}})();

请帮帮我

1 个答案:

答案 0 :(得分:0)