I’m getting an odd child-scope issue, with the following html view:
<content has-header="true" scroll="true" padding="true">
<div id="search-bar">
<div class="item item-input-inset">
<label class="item-input-wrapper" id="search-input">
<i class="icon ion-search placeholder-icon"></i>
<input type="text" placeholder="Search" id="search" ng-model="request" ng-change="search();" />
</label>
</div>
</div>
<h1>Hello World</h1>
<p ng-repeat="result in results">{{result.name}}</p>
</content>
When search()
function runs, it has no idea what $scope.request
is, it becomes undefined. Looking at the scopes through batarang I noticed it’s showing as a child scope. Is that expected? Seems like I should be able to access $scope.request
without having to dig through scopes.
If I remove the <content>
directive, then the scopes align and are accessible. However I lose the styling associated with the directive.
Here is the code from my controller, It’s taken from the Flickr example app where it works fine:
var doSearch = ionic.debounce(function(query) {
console.log($scope.request);
}, 500);
$scope.search = function() {
doSearch($scope.request);
}