如何通过从angularjs中的下拉框中选择相应选项来显示数据

时间:2013-09-26 14:35:41

标签: angularjs

Trying to display arts data by selecting "Arts & Culture" option from drop down box

我试图仅在" Arts&培养"选项从下拉框中选择,其默认值为"选择类别"。我的HTML中的代码是:

<div class="well">
    <h3>All Adventures</h3>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <table>
    <tr><td>
    <select name="" id="" ng-model="category" ng-options="c for c in categories">
        <option value="">-- Choose Category --</option>
    </select>
    </td>
    <td><input type="text" value="Enter Current Location" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><select name="" id="" ng-model="tMode" ng-options="tM for tM in tModes">
        <option value="">-- Choose Transportation Mode --</option>
    </select></td>
    </tr>
    </table>
    <br/>
</div>

        <ul class="unstyled">
        <li ng-repeat="art in arts">
            <div class="well">
                <h4>{{art.name}}</h4>
                <h5><em>{{art.formatted_address}}</em></h5>
                <p>{{art.formatted_phone_number}}</p> 
                <p>{{art.vicinity}}</p>
                <p>{{art.types}}</p>                    
            </div>
        </li>
    </ul>

我必须对代码进行哪些更改才能使其正常工作。我一直在网上尝试很多例子,但到目前为止还没有运气。

1 个答案:

答案 0 :(得分:4)

<li ng-repeat="art in arts" ng-show="category == 'Arts & Culture'">