小编Aka*_*Rao的帖子

如何在ionic2中的pop()之后重新加载离子页面

我有2页Page1 and Page2.我this.nav.pop()在Page2中使用它会弹出Page2和Page1会启用但我想刷新Page1.先感谢您.

javascript ionic2 angular

25
推荐指数
6
解决办法
3万
查看次数

如何在angular2中使用sweetalert2

在角度项目中的npm开始后获取此错误.

app/app.component.ts(12,7):错误TS2304:找不到名称'swal'.app/app.component.ts(21,7):错误TS2304:找不到名称'swal'.

我创建了一个角度项目.在app.component.ts里面我添加了甜蜜的警报代码

export class AppComponent {
deleteRow() {
      swal({
      title: 'Are you sure?',
      text: "You won't be able to revert this!",
      type: 'warning',
      showCancelButton: true,
      confirmButtonColor: '#3085d6',
      cancelButtonColor: '#d33',
      confirmButtonText: 'Yes, delete it!'
    }).then(function() {
      swal(
        'Deleted!',
        'Your file has been deleted.',
        'success'
      );
    })
  }
}
Run Code Online (Sandbox Code Playgroud)

我做到了

npm install sweetalert2 --save 
Run Code Online (Sandbox Code Playgroud)

并在index.html中添加了路径

<script src="node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" type="text/css" href="node_modules/sweetalert2/dist/sweetalert2.css">
Run Code Online (Sandbox Code Playgroud)

javascript typescript sweetalert angular sweetalert2

16
推荐指数
4
解决办法
3万
查看次数

如何在ionic2的pop方法中传递参数

我尝试在ionic2的push方法中传递参数.像这样

this.nav.push(SecondPage, {
    thing1: data1,
    thing2: data2
});
Run Code Online (Sandbox Code Playgroud)

但有没有办法在pop()中传递参数.

javascript ionic2 angular

14
推荐指数
3
解决办法
2万
查看次数

在Angularjs中禁用按钮上的ng-mouseover

我想在mouseover禁用按钮时使用.在下面的代码mouseover将工作,ng-disabled="false"但如果,它将无法工作ng-disabled="true".

<body ng-app="ngAnimate">
  <button ng-disabled="true" ng-mouseover="show=true" ng-mouseleave="show = false">
    Mouseover
  </button>
  <div>
  Show:
    <span class="test" ng-show="show">
      I show up when your mouse enter on button
    </span>
  </div>

</body>
Run Code Online (Sandbox Code Playgroud)

html javascript angularjs

10
推荐指数
1
解决办法
5531
查看次数

如何在React Native中重用React JS组件

我是新来的React JS.我想建立这样想过用的Web应用程序也应在移动(Android和IOS)工作,react jsweb application创造一些元件.所以可以使用该React js组件React native.

javascript reactjs react-native

8
推荐指数
2
解决办法
3160
查看次数

如何在javascript中替换'[''与'$ {'

我试图取代[[${.

var str = "it is [[test example [[testing";
var res = str.replace(/[[[]/g, "${");
Run Code Online (Sandbox Code Playgroud)

我得到的结果,"it is ${${test example ${${testing"但我想要的结果"it is ${test example ${testing".

javascript regex

5
推荐指数
1
解决办法
148
查看次数

如何在firebase中更新后返回Success数据

我试图在firebase中更新后返回数据,但它显示为 undefined

    test().then((res) => {
        alert(res);
      });

    test() {
    var fredNameRef = new Firebase('https://docs-examples.firebaseio.com/samplechat/users/fred/name');

    var onComplete = function(error) {
      if (error) {
        return error;
      } else {
        return "success";
      }
    };
    fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete);
    }
Run Code Online (Sandbox Code Playgroud)

javascript firebase angular

2
推荐指数
1
解决办法
2914
查看次数

Firebase child_added`this`无效

我正在开发一个聊天应用程序Angular2, ionic2 and firebase.为了得到聊天,我尝试了以下方法

控制器代码:

displayAllMessage() {
    let myDataRef = new Firebase("firbaseurl");
    myDataRef.on('child_added', function(snapshot) {
      this.message = snapshot.val();
      console.log(this.message);
    });
  }
Run Code Online (Sandbox Code Playgroud)

查看代码:

<h1> {{message.text}} </h1>
Run Code Online (Sandbox Code Playgroud)

但这里的问题是 - 如果我使用this.message它是抛出错误说this.message未定义,如果我使用var message而不是this然后它工作正常.如果我使用,var message那么我无法在视图中显示它.

先感谢您.

javascript firebase ionic2 angular

0
推荐指数
1
解决办法
587
查看次数