How can I access variables within another function?
myApp.controller "RegistrationsController", ($scope, $location, $http, $modal)->
$scope.open = () ->
# move to global
modalInstance = $modal.open(
templateUrl: "/assets/angular/templates/registrations/_signup.html",
controller: "ModalController"
)
$scope.cancel = ->
modalInstance.dismiss('cancel')
$scope.saveUser = () ->
$scope.cancel()
From the code above I'm trying to dismiss the modalInstance
(modal opened) via cancel
function.
However, I guess I need to make modalInstance
a global variable first?