Content tag and model


#1

Since I use the tag content, I am unable to access my model from my controller.
And this happens to me when I use this tag.

Partial:

<content has-header="true">
<form ng-submit="submit();">
<div class="list list-inset">
  <label class="item item-input">
    <input type="tel" placeholder="Phone number" ng-model="phone">
  </label>
  <br>
  <input id="submit" type="submit" class="button button-block button-positive" value="Let's Go">
</div>
</form>
</content>

Controller ( submit function returns undefined ):

piltControllers.controller('SignInCtrl', ['$scope', '$http',
function($scope, $http) {
$scope.submit = function(){
  alert($scope.phone);
}
}]);

#2

Because Ionic directives frequently have isolate scopes, you might need to do this:

<form name="$parent.userForm" ng-submit="submit();">

<content has-header="true">
<form name="$parent.userForm" ng-submit="submit();">
<div class="list list-inset">
  <label class="item item-input">
    <input type="tel" placeholder="Phone number" ng-model="phone">
  </label>
  <br>
  <input id="submit" type="submit" class="button button-block button-positive" value="Let's Go">
</div>
</form>
</content>

#3

Thank you very much but it doesn’t work


#4

You’ll need to setup a small sample on CodePen or something so we can take a look.


#5

Thanks, I solved my problem by specifying the controller for the form. But it must be depreciated? (The view is already linked to a controller by the router).

<content has-header="true">
<form ng-controller="SignInCtrl" ng-submit="submit();">
<div class="list list-inset">
  <label class="item item-input">
    <input type="tel" placeholder="Phone number" ng-model="phone">
  </label>
  <br>
  <input id="submit" type="submit" class="button button-block button-positive" value="Let's Go">
</div>
</form>
</content>