Angular 2 routerLink使用语义URL

时间:2016-05-31 16:44:54

标签: angularjs angular angular-routing

我试图在列表页面上构建>>> payload = "{\"text\": %s,\"count\":\"1 \"}" % ("'R'+str(i)") >>> payload Out[2]: '{"text": \'R\'+str(i),"count":"1 "}' >>> payload = "{\"text\": \"%s\",\"count\":\"1 \" }" % ('R'+str(i)) >>> payload Out[4]: '{"text": \'R\'+str(i),"count":"1 "}' >>> payload = "{\"text\": %s,\"count\":\"1 \" }" % ('"'+'R'+str(i)+'"') >>> payload Out[6]: '{"text": \'R\'+str(i),"count":"1 "}' >>> payload = "{\"text\": %s,\"count\":\"1 \" }" % ('"'+'R'+str(i)+'"') >>> payload Out[8]: '{"text": \'R\'+str(i),"count":"1 "}' >>> payload = "{\"text\": %s,\"count\":\"1 \" }" % ("+'R'+str(i)+")

我的路线定义如下:

routerLink

最终结果链接如下所示:

{ path: '/brands/:brandId/regions', component: RegionListComponent }

我试图弄清楚如何编写routerLink:

<a href="/brands/100/regions">Brand Regions</a>

以上链接显示在表格中,因此<a [routerLink]="['/brands/?????'], ????">regions</a>将基于brandId次迭代。

ngFor是我不确定该怎么做的地方。

1 个答案:

答案 0 :(得分:1)

$orders = $wpdb->get_results("SELECT 
        a.productID, 
        SUM(a.quantity) as totalQuantity, 
        SUM(a.amount) as totalSales 
        FROM a 
        INNER JOIN b 
        ON a.orderID = b.orderID 
        WHERE a.productID = $productID
        GROUP BY productID");

$records = $wpdb->get_results("SELECT 
       p.productID, 
       p.productName, 
       COALESCE(SUM(a.quantity),0) as totalQuantity, 
       COALESCE(SUM(a.amount),0) as totalSales
     FROM wp_products p
     LEFT JOIN a 
     GROUP BY p.productID");

取决于路径段是在不同组件上还是在根组件上。