我有2页Page1 and Page2.我this.nav.pop()在Page2中使用它会弹出Page2和Page1会启用但我想刷新Page1.先感谢您.
在角度项目中的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) 我尝试在ionic2的push方法中传递参数.像这样
this.nav.push(SecondPage, {
thing1: data1,
thing2: data2
});
Run Code Online (Sandbox Code Playgroud)
但有没有办法在pop()中传递参数.
我想在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) 我是新来的React JS.我想建立这样想过用的Web应用程序也应在移动(Android和IOS)工作,react js为web application创造一些元件.所以可以使用该React js组件React native.
我试图取代[[用${.
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".
我试图在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) 我正在开发一个聊天应用程序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 ×8
angular ×5
ionic2 ×3
firebase ×2
angularjs ×1
html ×1
react-native ×1
reactjs ×1
regex ×1
sweetalert ×1
sweetalert2 ×1
typescript ×1