Im having problems with the scope for a modal. Im using the Angular Bootstap library to show the modal. My code is:
angular.module('myApp.workspaces')
.controller('ModalInstanceCtrl', function ModalInstanceCtrl($scope) {
    $scope.ok = function() {
        console.log('in ModalInstanceCtrl and $scope.form is ', $scope.form);
    };
})
.controller('WorkspacesCtrl', function WorkspacesController(workspacesService, $scope, $location, $modal) {
    $scope.uploading = false;
    $scope.noWorkspaces = false;
    $scope.myWorkspaces = [];
    $scope.showModal = function() {
        $scope.opts = {
            backdrop: true,
            backdropClick: true,
            dialogFade: false,
            keyboard: true,
            templateUrl: 'assets/workspaces/modalContent.html',
            controller: 'ModalInstanceCtrl',
            resolve: {}, // empty storage
            scope: $scope
        };
        $modal.open($scope.opts);
    };
});
And modalContent.html is:
<div class="modal-header">
  <h1>Workspace Name</h1>
</div>
<div class="modal-body">
    <form>
        <fieldset>
            <label for="name">Workspace Name:</label>
            <input type="text" name="name" ng-model="form.name" />           
        </fieldset>
    </form>
</div>
<div class="modal-footer">
    <div ng-model="test">hjhhhjsad</div>
    <button class="btn btn-primary" ng-click="ok()">OK</button>
    <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
When I open the modal and then click OK,the console output is:
in ModalInstanceCtrl and $scope.form is undefined
I've tried every solution provided in a previous question here. Including:
- passing scope: $scope as an option to the modal
 - changing ng-model="name" to ng-model="form.name"
 - changing ng-model="name" to ng-model="$parent.name"
 
However I still cannot get access to the inout value. What am I doing wrong?
EDIT I realised I can access the input value with
$scope.$$childHead.$$childHead.form.name
This clearly doesnt seem right though....