我的应用程序部署在localhost/upload上.
我使用以下代码生成相对URL.
Url::to('@web/my_controller/action'); // it returns /upload/my_controller/action
Run Code Online (Sandbox Code Playgroud)
但是,我需要这样的完整URL:http:// localhost/upload/my_controller/action.
我错过了什么吗?
我尝试搜索google和stackoverflow,但找不到答案。所以我的问题很简单:“我如何去除角度2、4中的当前分量”
例:
<div (click)="remove($event)">Remove Current Component</div>
remove($event) {
// this.destroy() ????
}
Run Code Online (Sandbox Code Playgroud)
基本上我想要的是ComponentRef看到这个答案 ngOnDestroy(),它叫this.cmpRef.destroy():
ngOnDestroy() {
if(this.cmpRef) {
this.cmpRef.destroy();
}
}
Run Code Online (Sandbox Code Playgroud)
但是ComponentRef由于动态创建组件,他得到了应有的回报。
我正在使用jQuery DataTables和服务器端处理模式.但我面临着数据表的问题,我在Datatables文档中搜索了所有内容,但找不到我的答案.
所以问题是我从服务器获得响应,就像这样:
正如您在此JSON响应中所看到的,JSON所需的data.data数据表是在数据表中设置此数据源,有一个属性是Custom Data Property,它工作正常并显示行.现在问题是数据表没有考虑JSON的分页参数,这就是它显示的原因:
请注意,我无法从服务器端更改JSON响应.
更新: 这是js调用脚本:
$(document).ready(function () {
$("#example").dataTable({
"ajax": {
url: app.getApiUrlWithAccessToken('lead/get_all'),
dataSrc: function(json){
return json.data.data;
}
},
"lengthMenu": [1,2,5,10,15],
"columns": [
{ "data": "first_name" },
{ "data": "last_name" },
{ "data": "title" },
{ "data": "email" },
{ "data": "city" },
{ "data": "status" }
],
"processing": true,
"serverSide": true
});
});
Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用auth.updateProfile方法设置用户自定义属性或属性,但它只保存displayName属性,因为它在其文档中提到:
this.af.auth.createUser({
email: formData.value.email,
password: formData.value.password,
}).then((user) => {
let userProfile = formData.value;
userProfile.role = AuthService.ROLE_PATIENT;
userProfile.displayName = `${formData.value.firstName} ${formData.value.lastName}`;
user.auth.updateProfile(userProfile).then(function(){
this.router.navigate(['/']);
});
Run Code Online (Sandbox Code Playgroud)
现在问题我如何设置用户的自定义属性,以便我可以让他们进入 FirebaseAuthState
问题:为什么我需要为每个用户保存自定义属性?
答:因为我正在使用Auth Guard来使用role保存在数据库示例中的属性来激活特定路由:
canActivate(route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
//Currently I'm using this which only check that user is logged in or not
return this.auth
.take(1)
.map((authState: FirebaseAuthState) => !!authState)
.do(authenticated => {
if (!authenticated) this.router.navigate(['/login']);
});
}
Run Code Online (Sandbox Code Playgroud)
但是我想要再检查一下以验证用户是否具有患者的角色,我在创建上述用户时保存了这个角色,例如:
return user.role …