Javascript 如何将图像链接从Laravel存储发送到前端(角度)。除图像外的所有工作属性 公共功能索引(){ $data=HeaderSlider::all(); 返回$data; }

Javascript 如何将图像链接从Laravel存储发送到前端(角度)。除图像外的所有工作属性 公共功能索引(){ $data=HeaderSlider::all(); 返回$data; },javascript,php,angular,laravel,Javascript,Php,Angular,Laravel,如何将(Laravel)图像作为链接发送到前端(角度) 我在哪里存储我的图像,哪一个像响应一样发送?我尝试在拉雷维尔使用存储,但没有成功?我只想从服务器发送链接到前端angular和angular bind src并打印图像。索引函数laravel中的所有我的数据都到了前端,除了图像链接之外的所有工作属性?laravel中的哪个文件夹是存储映像的主文件夹?我试着在谷歌答案上搜索,但我只找到了请求输入类型,我不想要那个 public function index(){ $dat

如何将(Laravel)图像作为链接发送到前端(角度) 我在哪里存储我的图像,哪一个像响应一样发送?我尝试在拉雷维尔使用存储,但没有成功?我只想从服务器发送链接到前端angular和angular bind src并打印图像。索引函数laravel中的所有我的数据都到了前端,除了图像链接之外的所有工作属性?laravel中的哪个文件夹是存储映像的主文件夹?我试着在谷歌答案上搜索,但我只找到了请求输入类型,我不想要那个

  public function index(){
        $data = HeaderSlider::all();
        return $data;
    }

  <ul *ngFor="let item of data">
    <img [src]="item.image"  />
  </ul>
  • 将列创建为

    if(!Schema::hasTable('file_attachment')){

    }


  • 作为响应,发送json格式的文件路径

    如果您将图像存储在laravel公共目录中。 如果图像在public/images/beautifulNature.jpg中可用。然后将/images/beautifulNature.jpg作为URL发送到前端,并在html组件中使用如下内容

       Schema::create('file_attachment', function (Blueprint $table) {
               $table->increments('FileAttachmentID');
               **$table->string('FileType')->nullable();
               $table->string('FilePath')->nullable();
               $table->integer('FileSourceID')->nullable();
               $table->integer('SourceID')->nullable();**
               //$table->dateTime('CreatedOn')->nullable();
               $table->integer('CreatedBy')->nullable();
               //$table->dateTime('ModifiedOn')->nullable();
               $table->integer('updated_by')->nullable();
               $table->timestamps();
      });
    
    
    
    我不明白这有点复杂,网站Url是另一个表格,您将在其中放置完整的Url,如www.example.com/api,您的图像路径将是storage/image/path,现在您必须设置www.example.com/storage/image/path
       Schema::create('file_attachment', function (Blueprint $table) {
               $table->increments('FileAttachmentID');
               **$table->string('FileType')->nullable();
               $table->string('FilePath')->nullable();
               $table->integer('FileSourceID')->nullable();
               $table->integer('SourceID')->nullable();**
               //$table->dateTime('CreatedOn')->nullable();
               $table->integer('CreatedBy')->nullable();
               //$table->dateTime('ModifiedOn')->nullable();
               $table->integer('updated_by')->nullable();
               $table->timestamps();
      });
    
    <img src="{{url('/images/beautifulNature.jpg')}}" alt="Image"/>