Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用AngularJs的Ionic中的警报框不工作_Angularjs_Ionic - Fatal编程技术网

使用AngularJs的Ionic中的警报框不工作

使用AngularJs的Ionic中的警报框不工作,angularjs,ionic,Angularjs,Ionic,我想使用angular js在ionic中创建一个警报框,但当我单击警报按钮时,什么也没有发生。请指点我。 这是我的index.html <!DOCTYPE html> <html lang="en" data-ng-app="ionicApp"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1

我想使用angular js在ionic中创建一个警报框,但当我单击警报按钮时,什么也没有发生。请指点我。 这是我的index.html

<!DOCTYPE html>
<html lang="en" data-ng-app="ionicApp">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

  <title>Ionic-AngularJS-Cordova</title>

  <!-- Ionic framework - replace the CDN links with local files and build -->    
  <link href="lib/ionicframework/ionic.min.css" rel="stylesheet">
    <link href="http://code.ionicframework.com/1.1.0/css/ionic.css" rel="stylesheet">

  <script src="lib/ionicframework/ionic.bundle.min.js"></script>

  <script src="js/app.js"></script>

  <script src="cordova.js"></script>

  <style>
      .box {height:300px;padding: 10px}
  </style>      
</head>

<body data-ng-controller="AppCtrl">
<ion-header-bar class="bar-balanced">

  <h1 class="title">Welcome to my web app</h1>
    <button class="button" data-ng-click="refresh()">
        <i class="icon ion-refresh"></i>
    </button>

</ion-header-bar>

<ion-content>

    <h1>Some Content</h1>


</ion-content>

<div class="bar bar-footer">
  <button class="button button-clear">Left</button>
  <div class="title">Title</div>
  <button class="button button-clear">Right</button>
</div>


</body>
</html>

单击“刷新”按钮时,我希望会出现一个弹出窗口。

我可以使用以下方法解决我的问题:

angular.module('ionicApp', ['ionic'])

 .controller('AppCtrl', function($scope) {


$scope.refresh = function(){
    alert("Button Pressed");
    };      

  ionic.Platform.ready(function() {
    navigator.splashscreen.hide();
  });

 });
问候

angular.module('ionicApp', ['ionic'])

 .controller('AppCtrl', function($scope) {


$scope.refresh = function(){
    alert("Button Pressed");
    };      

  ionic.Platform.ready(function() {
    navigator.splashscreen.hide();
  });

 });