Angular UI Router相同的TemplateUrls问题针对不同的国家

时间:2016-07-26 17:08:34

标签: angularjs angular-ui-router mean-stack

我正在使用带有$ stateProvider的AngularJS,其中2个不同的状态指向相同的模板。代码段位于

之下
<?php
include 'settings.php';

        // Create connection
        $conn = mysqli_connect($servername, $username, $password, $dbname);
        // Check connection
        if (!$conn) {
            die("Connection failed: " . mysqli_connect_error());
        }

$steamData = file_get_contents("http://steamcommunity.com/profiles/76561198258195397/inventory/json/730/2");
$data = json_decode($steamData, true);
$items = $data['rgDescriptions'];
foreach($items as $key => $item){
        $name = $item["market_hash_name"];
        $query = "SELECT price FROM itemprice WHERE market_hash_name = '$name'";
        $result = mysql_query($query) or die($query."<br/><br/>".mysql_error());
        $price = mysql_result($result, 0);
        echo '<div class="items"><center><img src="http://steamcommunity-a.akamaihd.net/economy/image/' . $item["icon_url"] . '" height="192" width="256"></center><div><center><h5 style="color:#'.$item["name_color"].'">'.$item["market_name"].'<br>'.$price.'</h5></center></div><br></div>';
    } 

mysqli_close($conn);
?>

问题是控件没有流向mytraining状态。请告诉我这是什么问题?

2 个答案:

答案 0 :(得分:1)

应该是:

url: "/training/me",

url: "training/me",

在mytraining州

答案 1 :(得分:0)

试试这个:

.state('training', {
    url: "/training",
    templateUrl: "partials/training.html",

/* ... some config ... */

.state('training.me', {
        url: "/me",
        templateUrl: "partials/training.html",