How do I access data that is inside my modal

I have an ionic modal like this:

<div class="modal">
   <ion-header-bar>
  </ion-header-bar>
  <ion-content>
    <div class="padding">
      <div class="list">
        <label class="item item-input">
          <span class="input-label">Name</span>
          <input ng-model="name" type="text">
        </label>
        <button class="button ng-click="addMessage()">Comment</button>
      </div>
    </div>
  </ion-content>
</div>

And in my controller:

$ionicModal.fromTemplateUrl('templates/modal.html', function (modal) {
	$scope.modal = modal;
},{
  scope: $scope,
	animation: 'slide-in-up',
	focusFirstInput: true
});

Now I want to access ng-model="name" inside my controller, how do i do it. Just simple $scope.name gives out null

You do it right but you should use vars like “modal.name” (it’s an angular problem)
Check this https://github.com/angular/angular.js/wiki/Understanding-Scopes

Can you explain a bit.

According to the article above having a ‘.’ in your models will ensure that prototypal inheritance is in play. So, use
<input type="text" ng-model="someObj.prop1"> rather than
<input type="text" ng-model="prop1">.

Ok suppose if i use ng-model="modal.name"

Then in my controller, I would do $scope.model.name ?

Yes, just like that.