Search code examples
javascriptangularjsnspopover

Why radio not selected in ns-popover popup. Radio is only seleced in table last column popup


I am setting radio model in angular controller but it is set in only table's last column popup.

ns-popover is appear on table column click.

Angular Code

var app = angular.module('app', ['nsPopover']);

app.controller('MainController', function ($q, $timeout) {
this.foo = "foobar!";

this.fields = [
    {id: 1, name: 'A'},
  {id: 2, name: 'B'},
  {id: 3, name: 'C'}
];

this.columns = [
    {
    id: 1,
    entries: [
        {columnType: 'a'},
      {columnType: 'b'},
      {columnType: 'c'}
    ]   
  },
  {
    id: 2,
    entries: [
        {columnType: 'a'},
      {columnType: 'b'},
      {columnType: 'c'}
    ]
  },
  {
    id: 3,
    entries: [
        {columnType: 'a'},
      {columnType: 'b'},
      {columnType: 'c'}
    ]
  }
];

    $('#example').popover();
});

example is here jsfiddle popup example


Solution

  • you are missing to set current active index updated fiddle link

    $scope.setIndex = function(index) {
    
        this.currentIndex = index;
    };
    this.currentIndex = -1;