what I am trying to do is to get to other page if my vm.Question is empty but it dose not work, here is my work
(function () {
'use strict';
angular.module('mainApp').controller('question-template', ['dataContext', function (dataContext, $location) {
var vm = this;
dataContext.getOneQuestion(sessionStorage.getItem("SavedString")).then(
function (response) {
vm.Question = response.data;
if (vm.Question.length == 0) {
$location.path("/noquestion"); <- HERE
return;
}
},
function (error) {
console.log(error);
}
}]);
})();
Any help would be awesome, thank you
['dataContext', function (dataContext, $location), add'$location'