Hi I am brand new to Angular. I have a table of data that I need to filter. 
I need to be able to filter the data with a navbar search box that is 
outside of the view where my table data will be displayed. I'm not really 
sure how to do this. I have this code inside my navbar this is where the 
search box should be:


<div class="form-group">
                <input type="search" class="form-control" placeholder="Search" 
id="searchText" name="searchText" ng-model="query">
            </div>
            <div class="form-group">                    
                
                <button class="btn default-btn lookupbtn">Lookup</button>

</div>



My table data currently looks like this:

<div>
<div>Lookup Results</div>
<!--<div><input type="text" id="searchText" name="searchText" ng-model="query" 
/></div>-->
<table ng-if="query">
    <thead>
        <tr>
            <td>Acc. ID</td>
            <td>Acc. Name</td>
            <td>Acc Address</td>
            <td>City</td>
            <td>Zip</td>
            <td>Phone</td>
            <td>Parent Name</td>
            <td>Account Type</td>
            <td>Account Status</td>
            <td>Credit Term</td>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="result in vm.results | filter:query ">
            <td>{{ result.accountId }}</td>
            <td>{{ result.accountName }}</td>
            <td>{{ result.address }}</td>
            <td>{{ result.city }}</td>
            <td>{{ result.state }}</td>
            <td>{{ reuslt.zip }}</td>
            <td>{{ result.phone }}</td>
            <td>{{ result.parentName }}</td>
            <td>{{ result.accountType }}</td>
            <td>{{ result.accountStatus }}</td>
            <td>{{ result.accountStatus }}</td>
            <td>{{ result.creditTerm }}</td>
        </tr>
    </tbody>
</table>


How can I get the navbar search box to work with the table in my view? If 
any other info is needed please let me know.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to