angular $scope safe apply as a component