Hi folks,
I am having a little problem with logic for dropdown

Here is my default screenshot as below:
https://lh3.googleusercontent.com/-jy-StnSG_SE/VvK7Z4FdE-I/AAAAAAAAIhM/BzHzYe_KKxQu9uc8o98LMfDbEMhFQLyXA/s1600/Default.png

When i selected rate at second row then i am getting all result list

https://lh3.googleusercontent.com/-yaPO1S6iQx4/VvK8L_7eHGI/AAAAAAAAIhU/PxaDdaFWf0Ar-kyHyxOND6Th7bPTbE2Aw/s1600/Selected.png

How to avoid all result list if i selected only one rating value?

here is my sample code as below:

*HTML:*
<table class="table table-striped table-hover table-bordered">
    <thead>
        <tr>
            <th>Name</th>
            <th>Rate</th>
            <th>Result</th>
        </tr>
    </thead>
    <tbody>
        <tr *ngFor="#name of names">
            <td>{{name}}</td>
            <td>
                <select (change)="onSelect($event.target.value)">
                    <option *ngFor="#rating of ratings" 
[value]="rating.result">{{rating.rate}}</option>
                </select>
            </td>
            <td>{{selectedResult}}</td>
        </tr>
    </tbody>
</table>

*TypeScript:*
export class AppComponent {
    selectedResult: number;

    names: Array<string> = ["Smith", "Smith", "Smith", "Alice", "Alice", 
"David"];

    ratings: Rating[] = [
        { "rate": "One", "result": 1 },
        { "rate": "Two", "result": 2 },
        { "rate": "Three","result": 3 },
        { "rate": "Four", "result": 4 },
        { "rate": "Five", "result": 5 },
    ];

    onSelect(resultValue) {
        this.selectedResult = resultValue;
    }
}

class Rating {
    rate: string;
    result: number
}

I am waiting for your response.
Thanks in advance

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to