我有将数据带到该变量的变量和方法的服务
export class UserService {
userDetails;
getUserProfile(){
return this.http.get(this.BaseURI+'/UserProfile').subscribe(
res=>{
this.userDetails=res;
// console.log(res);
},
err=>{
console.log(err);
}
);
}
Run Code Online (Sandbox Code Playgroud)
现在我想在变量更改时从组件中检查并读取它。我怎样才能做到这一点 ?
更新。
export class UserService {
userDetails;
getUserProfile(){
this.http.get(this.BaseURI+'/UserProfile').subscribe(
res=>{
this.userDetails=res;
},
err=>{
console.log(err);
}
)
}
Run Code Online (Sandbox Code Playgroud)
在组件中,我有这个:
ngOnInit() {
this.service.userDetails.subscribe((userDetails) =>this.userDetails=userDetails)
}
Run Code Online (Sandbox Code Playgroud)
现在,当我运行该应用程序时,组件出现错误:
AppComponent.html:2 错误类型错误:无法读取未定义的属性“订阅”
我有简单的 oracle 功能
create or replace function abs.test_func(test_in in number)
return number
is
test_out number ;
BEGIN
test_out:=test_in;
RETURN test_out;
END;
Run Code Online (Sandbox Code Playgroud)
如果我编译它 - 它编译成功。但是当我从 PLSQL Developer SQL Window 运行时
BEGIN abs.test_func(5); END;
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
ORA-06550: line1, column8;
PLS-00221: 'TEST_FUNC' is not a procedure or is undefined
ORA-06550: line1, column8;
PL/SQL: Statement ignored
Run Code Online (Sandbox Code Playgroud)
我的功能有什么问题?
我使用以下代码从textarea获取数据
$about_me=mysql_real_escape_string(nl2br($_POST['about_me']));
Run Code Online (Sandbox Code Playgroud)
1.使用$ _POST接收数据.2. nl2br刹车如此如果我向用户回复此代码,他会看到是否有新线路.3. mysql_real_escape_string在将数据输入数据库之前保护代码免受mysql注入.
所以如果我回应这个代码一切正常.
但是,如果我通过textarea再次编辑它,php转到mysql获取数据,将它放到textarea,我看到<br>
迹象......
如何在textarea中再次编辑文本时摆脱它们?
了解用户是否是正确的人而不是黑客的最佳方法是什么?例如,在我的项目中,当用户登录时,我创建一些带有一些数字的会话变量,然后在其他页面上,我检查这个会话变量,并根据它的值给用户一些选项.
那么黑客能否以某种方式更改此变量,以便服务器端授予他访问某些选项的权限?
如果是这样,保留一些用户权限并将其传递到不同页面的最佳方法是什么,那么服务器可以为该用户授予一些选项?
到目前为止,我正在使用这种类型的方法通过Ajax将一些变量发送到服务器端的php文件并带回一些答案.
$('#some_form').ajaxSubmit({
success: function(result)
{
some code....
}
});
$.post('serverside_script.php', { variable: 'value' },
function(result)
{
some code...
});
Run Code Online (Sandbox Code Playgroud)
答案始终是1变量,直到现在还可以.但是现在我需要从PHP方面回来几个变量.如何修改脚本以获取多个变量?
这有效
$('input[name=nickname]').css(...);
Run Code Online (Sandbox Code Playgroud)
现在我怎么能用变量写同样的东西呢?
string[1]='nickname';
Run Code Online (Sandbox Code Playgroud) loopVar=1;
alert('#imgAvatar'+parseInt(loopVar)+1);
Run Code Online (Sandbox Code Playgroud)
给了我#imgAvatar 11
而
alert(parseInt(loopVar)+1);
给了我2
我怎样才能获得#imgAvatar 2?
当我使用<i class="glyphicon glyphicon-leaf"></i>
它时效果很好。
但是如果我在 Html SelectBox 中尝试它就行不通了。
<select title="Select your spell" class="selectpicker" data-show-icon="true">
<option><i class="glyphicon glyphicon-leaf"></i>select</option>
<option data-icon="glyphicon glyphicon-eye-open"><i class="glyphicon glyphicon-leaf"></i>1</option>
<option data-subtext="<i class='glyphicon glyphicon-leaf'></i>">2</option>
</select>
Run Code Online (Sandbox Code Playgroud) 我有打开材质对话框的组件 A
组分A
openDialog(): void {
const dialogRef = this.dialog.open(**component B**, {
width: '1000px',
});
Run Code Online (Sandbox Code Playgroud)
然后我使用在该对话框中加载图像并使用按钮上传我使用组件 B 将其上传到服务器。现在,当我完成上传图像时,我想从组件 B 关闭该对话框。
B组份
onUpload() {
const fd = new FormData();
fd.append('image', this.selectedFile);
this.service.uploadImage(fd).subscribe(
(res:any)=>
{
//how to close dialog here ?
},
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点 ?
我有一些图像,我希望colorbox直接从鼠标点击img
标签开始其画廊,而不是hyperlink
像规则那样在标签上.有没有办法做到这一点?
javascript ×3
jquery ×3
php ×3
angular ×2
ajax ×1
asp.net-mvc ×1
colorbox ×1
components ×1
mysql ×1
oracle ×1
plsql ×1
select ×1
service ×1
session ×1
sql ×1
sql-function ×1
variables ×1