Introducing $scope.wrap variable to fix angular bug with nested scopes.