Why when I append an element does it have no styles?

108 Views Asked by At

I have a list displayed in a div with angular ng-view, when loading the page the list items are added like this

var activedates = [];

  var folder = "/sdcard/.JWHelper";
  var txtlist = app.ListFolder(folder+"/reports");
  txtlist.forEach((item)=> {
    var content = app.ReadFile(folder + "/reports/" + item).toString();
    var objects = JSON.parse(content);
    activedates.push(`${objects.day}/${objects.month}/${objects.year}`)
  })
  activedates.forEach((index)=> {
    let fdate = index.split("/")

    var headerdate = getDay(fdate[0], index)

    let html = '<section>';
    html += '<md-subheader class="md-accent">'+headerdate+'</md-subheader>';
    html += '<md-list layout="column" layout-padding>';
    html += `<md-list-item class="md-3-line" ng-repeat="notes in reports" ng-show="${fdate[0]} == {{notes.day}} && ${fdate[1]} == {{notes.month}} && ${fdate[2]} == {{notes.year}}">`;
    html += '<i class="material-icons md-avatar" aria-hidden="true">{{notes.icon}}</i>';
    html += ' <div class="md-list-item-text">';
    html += '<h3>{{notes.title}}</h3>';
    html += ' <p>{{notes.note}}</p>';
    html += ' </div>';
    html += '<i class="material-icons md-secondary" aria-hidden="true">{{notes.icon_secundary}}</i>';
    html += '</md-list-item>';
    html += '</md-list>';
    html += '</section>';

    $(".box").append(html);
  })

With this everything works fine, the elements are shown well, but I have a button to add another element to the list, when pressed this function is called

function addReport(d, m, y, h, p, r, v, c) {
    var $scope = getScope("ReportsCtrl");
    d = Number(d);
    m = Number(m)
    y = Number(y)
    h = alldate.getHours();
    ms = alldate.getMinutes();
    s = alldate.getSeconds();
    comprobeHeader(d,
      m,
      y)
    app.WriteFile(folder + "/reports/" + d+m+y+h+ms+s + ".txt",
      `{"day":${d},"month":${m},"year":${y},"hours":${h},"publications":${p},"revisits":${r},"videos":${v},"comments":"${c}" }`);
    $scope.addReport(d,
      m,
      y,
      h,
      p,
      r,
      v,
      c)

  }

When the list date already has an existing subtitle, it is added correctly, but when it is new, the subtitle is added without styles and the item in the sale list with rare symbols, How can i fix this?

Image

0

There are 0 best solutions below