在角深层链接? [英] Deep linking in angular?

查看:81
本文介绍了在角深层链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习深层链接的角度。

I am trying to learn deep linking in angular.

当我点击它与创建一个链接NG-重复类似下面的EXP:

As I click on a link which is created with ng-repeat like on the exp below:

<ul ng-controller="ShowOrderController">
   <li ng-repeat="car in cars"><a href="#ShowOrder/cars.indexOf(car)">
   {{car.Brand}}</a>
   </li>
 </ul>

它不显示被点击链接的相关的​​细节

It doesn't display relevant detail of the clicked link

我明白,我不是那个链接我的正确控制器上:

I understand that I am not linking that properly on my controller:

sampleApp.controller('ShowOrderController', function($scope, $http, $routeParams) {

  $http.get('data.json').
    success(function(data){
      $scope.cars = data;
      $scope.car_id = $routeParams.carId;
    });

});

我只是想不通,或发现解释清楚如何建立深度链接的来源。

I just can't figure out or find any source that explains plainly how to create deep linking..

经验: http://plnkr.co/edit/7D0UegRrtKPxrZ8zfxEL?p=preVIEW

非常感谢事先!

推荐答案

试试这个。工作演示

您可以更改过滤器像下面

You may change the filter as like below

<div ng-controller="ShowOrderController" ng-repeat="car in cars | filter: { id: car_id } | limitTo:1">

这篇关于在角深层链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆