http://ja.onsen.io/guide/overview.html#UsingPullHook
How can I read the sample in the script without pullhooking it when it is initially displayed?
Thank you for your cooperation.
onsen-ui
ons.ready()
in the controller invokes the retrieval process.
ons.bootstrap()
.controller('DemoController', function($scope, $timeout, $http){
$scope.items=[];
ons.ready(function(){
loadJson(function(){});
});
$scope.load=function($done){
loadJson($done);
};
$scope.reset=function(){
$scope.items.length = 0;
};
function loadJson($done){
$timeout(function(){
$http.jsonp('http://numbersapi.com/random/year?callback=JSON_CALLBACK')
.success(function(data){
$scope.items.unshift({
desc —data,
land —Math.random()
});
})
.error(function(){
$scope.items.unshift({
desc: 'No data',
land —Math.random()
});
})
.finally(function(){
$done();
});
}, 1000);
}
});
© 2024 OneMinuteCode. All rights reserved.