use $scopeinstead self. Since $applyit is an angular js $ scope function, so you cannot call it throughthis
viewTest.controller('viewTest', function ($scope,$location) {
var self = this;
self.$onInit = function (location) {
$scope.$apply()
}
});
source
share