小编Pal*_*diN的帖子

在laravel中访问公用文件夹内的图像

如何在public/images不使用Laravel自己的功能的情况下访问存储在文件夹中的图像assets()

我只想获取存储在images文件夹中的图像的直接URL.

例如:

localhost/webapp/images/stackoverflow.png
Run Code Online (Sandbox Code Playgroud)

请求链接时,我应该得到直接图像.

laravel

27
推荐指数
5
解决办法
8万
查看次数

Angular 2 ngSwitchCase,OR运算符无法正常工作

我有多个switch语句,但在某些情况下我需要常见的情况.所以,我正在尝试

OR operator => ||

例:

        <ng-container [ngSwitch]="options">
            <ng-container *ngSwitchCase="'a'">Code A</ng-container>
            <ng-container *ngSwitchCase="'b'">Code B</ng-container>
            <ng-container *ngSwitchCase="'c'">Code C</ng-container>
            <ng-container *ngSwitchCase="'d' || 'e' || 'f'">Common Code</ng-container>
            <ng-container *ngSwitchDefault>Code Default</ng-container>
        </ng-container>
Run Code Online (Sandbox Code Playgroud)

输出:

if case = 'd' returns Common Code
else if case = 'e' and 'f' returns the Code Default 
Run Code Online (Sandbox Code Playgroud)

这里的第二个案例由多个案例组成,现在默认情况下case 'd'只有工作且不起作用case 'e' and 'f'.

我在ngSwitchCase文档中看不到任何多个案例:

https://angular.io/docs/ts/latest/api/common/index/NgSwitchCase-directive.html https://angular.io/docs/ts/latest/api/common/index/NgSwitch-directive.html

Angular 2不支持||运营商ngSwitchCase吗?

switch-statement or-operator ng-switch angular

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

Bitbucket无法克隆存储库"致命:早期EOF致命:索引包失败"

我正在尝试使用sshfrom 克隆我的存储库,bitbucket但每当我克隆存储库时,我得到:

Connection to bitbucket.org closed by remote host.00 KiB/s
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Run Code Online (Sandbox Code Playgroud)

在克隆过程中,克隆的存储库small size会被克隆,但是克隆bigger size存储库会产生错误.我也尝试过这种方法:

致命:早期EOF致命:索引包失败

但没有运气.任何人都可以帮助解决这个问题吗?

注意:

Http克隆工作正常,但在我的方案中不起作用.我只需要使用克隆ssh.

git bitbucket git-clone fatal-error

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

laravel 5.4:Laravelcollective/html v5.3.0需要照亮/查看5.3.*

我用Laravelcollective/html v5.3.0laravel 5.3.现在我正在使用laravel 5.4.我有正在使用的表格Laravelcollective/html v5.3.0.

composer require laravelcollective/html给我下面的错误:

Installation request for laravelcollective/html ^5.3 -> satisfiable by laravelcollective/html[v5.3.0].
-Conclusion: remove laravel/frameworkv5.4.0
 - Conclusion: don't install laravel/framework v5.4.0
Run Code Online (Sandbox Code Playgroud)

什么时候laravel 5.4支持Laravelcollective/html

php forms laravel laravelcollective

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

是否可以将默认值设置为&lt;ng-content&gt;

我只是从本教程中学习Transluctionin 的用法angular2

https://scotch.io/tutorials/angular-2-transclusion-using-ng-content

我可以将<ng-content>标记用于某些内容,例如:

<ng-content select="[my-block-header]"></ng-content>
Run Code Online (Sandbox Code Playgroud)

它位于my-block附加选择器的组件中。

它将来自其他组件的内容呈现为:

<my-block>
    <div class="box-header" my-block-header> <--added the slot selector here
        <h3 class="box-title">
            My title
        </h3>
    </div>
</my-block>
Run Code Online (Sandbox Code Playgroud)

问题是:

<ng-content>如果我们没有传递任何值,是否可以将默认值添加到可以使用的块中?

到目前为止,如果没有传递任何值,则该位置将出现空白页。

编辑:

当我尝试测试时,有一个较新的版本zone.js不允许显示正确的错误,因此我得到的错误为:

Cannot set property 'stack' of undefined ; Zone: <root> ; 
Task: Promise.then ; Value: TypeError: Cannot set property 'stack' of undefined
Run Code Online (Sandbox Code Playgroud)

但是,当我改变的版本zone.js0.7.2错误控制台作为清楚地提到:

zone.js:392 Unhandled Promise rejection: Template parse errors:
<ng-content> element cannot have content.
Run Code Online (Sandbox Code Playgroud)

因此,它确认没有任何默认值设置为 <ng-content>

default-value angular2-ngcontent angular

7
推荐指数
3
解决办法
2051
查看次数

Angular 2覆盖组件

我来自Laravel世界,对Angular 2世界有点新意,我很难弄明白:

是否可以覆盖Angular 2中的组件或模板,就像我们用来覆盖Laravel中供应商/自定义包的视图一样?

这是一个虚拟文件夹结构,可能表达我的意思:

|-resources
   |-assets
      |-typescript
         |-core
            |-core.component.ts    //overridded core component and template
            |-core.template.html
|-Modules
   |-Core
      |-Resources
         |-assets
            |-typescript
               |-core
                  |-core.component.ts  //main module component and template
                  |-core.template.html
Run Code Online (Sandbox Code Playgroud)

core.template.html(原创)

<div>
    <p> This is a core component's template</p>
    <button>Click me! </button>
</div>
Run Code Online (Sandbox Code Playgroud)

core.template.html(重写)

<div>
    <p> This is a overridden core component's template</p>
    <p> Removed the button and overridden with p-tag </p>
</div>
Run Code Online (Sandbox Code Playgroud)

希望我已经清楚地说明了我面临的问题.

overriding modular laravel angular-template angular

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

angular 2 打字稿中的助手/特征

我属于phpLaravel和新的首发上angulartypescript

我想知道是否有一些TraitsHelpers喜欢php

我看到有这样的declined提议:

https://github.com/Microsoft/TypeScript/issues/311

也有人试图实现Helpersas Servicehttps : //stackoverflow.com/a/35666878/3887342

什么是写的最好的方式HelpersTraits是否可用?

php traits typescript angular

5
推荐指数
0
解决办法
1447
查看次数

vue-router:防止在参数更改时路由

我正在尝试确认离开未保存的路线,如果用户拒绝,则取消更改路线.

它主要用于

beforeRouteLeave: function (to, from, next) { 
                      if (!confirm('Leaving form')) next(false);
                   }
Run Code Online (Sandbox Code Playgroud)

问题在于路由参数,比如#/form-path?id=5- 更改id参数不会触发beforeRouteLeave.

我可以使用哪个钩子来防止参数更改导航?

javascript vue.js vue-router vuejs2

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

动态添加和删除angular 2自定义子组件中的formGroup

我有一个自定义开关,需要使用和不使用forms.即

定制switch.component.html

<div class="custom-switch" [formGroup]="parentGroup">
    <input id="{{ id }}" name="status" type="checkbox"
           [checked]="checked"
           formControlName="{{ switchName }}"
           (change)="onChange($event, id)" />
    <label for="{{ id }}" class="label-default" data-toggle="tooltip" data-selector="true"
           data-title="Switch"></label>
</div>
Run Code Online (Sandbox Code Playgroud)

定制switch.component.ts

import { Component, Input } from "@angular/core";
@Component({
    selector : 'custom-switch',
    template : 'custom-switch.component.html'
})
export class CustomSwitchComponent {
    @Input('id') id : any = 'switch';
    @Input('parentGroup') parentGroup : any;
    @Input('switchName') switchName : any;

    onChange() {
        //do something
    }
}
Run Code Online (Sandbox Code Playgroud)

从父组件我调用表单子组件的组件为:

<custom-switch [parentGroup]="form" [switchName]="'switch'"></custom-switch>
Run Code Online (Sandbox Code Playgroud)

我想用:

<custom-switch></custom-switch>
Run Code Online (Sandbox Code Playgroud)

并删除

[formGroup]="parentGroup"formControlName="{{ switchName …

angular2-forms angular2-template angular

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

检查拦截器的角度路线

我有一个配置为的路由路径:

{
    path: 'user/:id/edit/:type',
    component: UserEditTypeComponent,
},
Run Code Online (Sandbox Code Playgroud)

我想到达拦截器的路径,可以从激活的路径访问该拦截器,如下所示:

constructor(private activatedRoute: ActivatedRoute) {
}

ngOnInit() {
    console.log(this.activatedRoute.routeConfig.path);
}
Run Code Online (Sandbox Code Playgroud)

这将导致在user/:id/edit/:type控制台中返回此路径。

我想从拦截器获得与我尝试的相同的路径:

intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    let ar = this.injector.get(ActivatedRoute);
    console.log(ar.routeConfig.path);
}
Run Code Online (Sandbox Code Playgroud)

这将返回错误为:Cannot read property 'path' of null。我已删除路径并进行测试,发现routeConfig为空。

我们如何在拦截器内部获得激活的路线?

还有其他方法可以访问pathin拦截器吗?

如果问题不清楚,可以用更多信息进行更新。

angular angular-activatedroute

5
推荐指数
2
解决办法
1913
查看次数