JavaScript bootstrap modal should have selected table row obtained from json (Angular) bootstrap modal should not close on escape,bootstrap modal should

I have a table and using ng-repeat data is populated, which is obtained from JSON

Table has name, phone and time

when i click on name a bootstrap modal pops up, but i need to have selected name inside bootstrap modal

        <tbody>
        <tr ng-repeat='row in rows'>
            <td data-toggle="modal" data-target="#myModal" ng-modal="" > <a>{{row.name}}</a></td>

                 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-content">
                      <div class="modal-body">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">{{row.name}} Details</h4>
                      </div>
                    </div>
                </div>

            <td>{{ row.phone}}</td>
            <td>{{row.time}} </td>
        </tr>
    </tbody>

http://plnkr.co/edit/JX1hxzknZ0YIJKnzSGaf?p=preview

I want table's clicked name to be on modal heading

Any help is appreciated. Thanks in advance

Answer:1

Add an ng-click handler that sets the name to a scope property. Then use this property to be the title of the modal heading.

In your HTML that generates the table:

ng-click="setName(row.name)"

In your controller: $scope.selectedName = null;

$scope.setName = function(name) {
  $scope.selectedName = name;
}

Then you would use this for your modal header

{{selectedName}}
Answer:2

When is asObservable() needed on a Subject (e.g. BehaviorSubject) to get a observable of the subject? The subject isself can be casted to an Observable as well. Questions What are the technical ...

When is asObservable() needed on a Subject (e.g. BehaviorSubject) to get a observable of the subject? The subject isself can be casted to an Observable as well. Questions What are the technical ...

I wrote a gulp file that works but...not at any attempts. Indeed, I get this weird error 1 time / 3: [12:25:51] Starting 'default'... [12:25:51] Starting 'clean'... [12:25:51] Finished 'clean' ...

I wrote a gulp file that works but...not at any attempts. Indeed, I get this weird error 1 time / 3: [12:25:51] Starting 'default'... [12:25:51] Starting 'clean'... [12:25:51] Finished 'clean' ...

  1. gulp unhandled stream error in pipe
  2. gulp uglify unhandled stream error in pipe

I need to scroll to a form field (a displayfield actually) automatically. Since the field is dynamic, sometimes it is already shown in the rendered area of page, sometimes it is not. How can I do ...

I need to scroll to a form field (a displayfield actually) automatically. Since the field is dynamic, sometimes it is already shown in the rendered area of page, sometimes it is not. How can I do ...

I have read similar questions and no solutions seem to be working for this. I have a Angular material input box. The input should receive only numbers and a decimal dot. All other characters should be ...

I have read similar questions and no solutions seem to be working for this. I have a Angular material input box. The input should receive only numbers and a decimal dot. All other characters should be ...

  1. regular expression remove characters
  2. regular expression remove spaces
  3. regular expression remove blank lines
  4. regular expression remove punctuation
  5. regular expression remove whitespace
  6. regular expression remove numbers
  7. regular expression remove html tags
  8. regular expression remove line break
  9. regular expression remove characters from string
  10. regular expression remove everything after character
  11. regular expression remove non alphanumeric
  12. regular expression remove punctuation python
  13. regular expression remove non numeric
  14. regular expression remove spaces between words
  15. regular expression remove letters
  16. regular expression remove carriage return
  17. regular expression remove leading spaces
  18. regular expression remove last character
  19. regular expression remove all numbers
  20. regular expression remove trailing character