{
"name": "someProject",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"start": "webpack -w",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"angular": "^1.6.2",
"angular-ui-router": "^0.4.2"
},
"devDependencies": {
"@types/angular": "^1.6.5",
"@types/angular-ui-router": "^1.1.36",
"@types/node": "^7.0.5",
"ts-loader": "^2.0.0",
"typescript": "^2.1.6",
"webpack": "^2.2.1"
}
}
/**
* Created by Partizanin on 20.09.2016.
*/
var app = angular.module("converterApp", []);
app.controller("converterController", function ($scope, $http, $q) {
/*start create function*/
$scope.callToServer = function (request) {
$scope.showLoader();
var deferred = $q.defer();
var myData = {"operationCall": request};
$http({
url: '/ConventerServlet',
method: 'GET',
params: {jsonData: JSON.stringify(myData)}
}).success(function (data) {
$scope.showLoader();
deferred.resolve(data);
});
return deferred.promise;
};
$scope.showLoader = function () {
$scope.loaderStatus = !$scope.loaderStatus;
};
$scope.buttonClick = function () {
$scope.buttonDisable = !$scope.buttonDisable;
console.log("buttonClick " + $scope.buttonDisable);
};
$scope.selectExchange = function () {
$scope.changeCourse($scope.selectedExchangeValue + "/" + $scope.selectCourseValue);
console.log("selectedExchange: " + $scope.selectedExchangeValue);
};
$scope.selectCourse = function () {
$scope.changeCourse($scope.selectedExchangeValue + "/" + $scope.selectCourseValue);
console.log("selectCourse: " + $scope.selectCourseValue);
};
$scope.changeCourse = function (request) {
$scope.callToServer(request).then(function (data) {
$scope.rows = data.rows;
if (data.id) {
$scope.selectedExchangeValue = data.id;
}
/** @namespace data.optionsCourse */
if (data.optionsCourse) {
$scope.optionsCourses = data.optionsCourse;
}
/** @namespace data.optionsValute */
if (data.optionsValute) {
$scope.optionsValutes = data.optionsValute;
}
});
};
/*end create function*/
/*start initialize variable*/
$scope.inputValue = 1;
$scope.selectedExchangeValue = "UAH";
$scope.selectCourseValue = "Google";
$scope.buttonDisable = true;
$scope.rows = {};
$scope.optionsCourses = {};
$scope.optionsValutes = {};
/*end initialize variable*/
/*start working area*/
$scope.changeCourse("load");
/*end working area*/
});
@types/angularи
один @types/angularjs
.
спасибо