fix true handling from query

pull/27/head
Szekeres Bálint 2018-10-26 20:29:55 +02:00
parent b87661c846
commit b03970ea1d
1 changed files with 6 additions and 0 deletions

View File

@ -202,10 +202,16 @@
var hashData = $location.search(); var hashData = $location.search();
for (var key in hashData) { for (var key in hashData) {
// handle false
if (hashData[key] === 'false') { if (hashData[key] === 'false') {
hashData[key] = false; hashData[key] = false;
} }
// handle true
if ((hashData[key] === 'true' || hashData[key] === '') && typeof $scope.data[key] === 'boolean') {
hashData[key] = true;
}
if ($scope.data[key] !== undefined && typeof $scope.data[key] === typeof hashData[key]) { if ($scope.data[key] !== undefined && typeof $scope.data[key] === typeof hashData[key]) {
$scope.isDirty = true; $scope.isDirty = true;
$scope.data[key] = hashData[key]; $scope.data[key] = hashData[key];