My end goal is creating a table that has sortable columns. I am currently following a tutorial and trying to apply it to my project, but it seems the way I have my code set up that this won't work. I haven't found many tutorials that intersect with my use case with Flask and Angular.
The issue I am having now is that the scope ends at where I am defining the controller. I need items defined by flask's templating system to be added to the angular model.
My flask app is returning json that is consumed by the templating system(Jinja2). Here is my html file. You can see that I have tried to define an "artist" model via ng-model for each artist in the dict of artists.
<div class="artist-table-container" ng-controller="ArtistTableCtrl">
<table class="table artist">
<tr>
<th class="artist-table-header"></th>
<th class="artist-table-header">Artist Name</th>
<th class="artist-table-header">Number of Albums Released</th>
<th class="artist-table-header">Most Recent Album</th>
<th class="artist-table-header">Top Track</th>
</tr>
{% for artist in artists%}
<tr ng-model="artist">
<td><div class="artist-img-sml"><img class="artist-cover-sml" src="imgs/cover.png" height="64" width="64"><img src={{artist.col_img}} height="64" width="64"></div></td>
<td>{{artist.name}}</td>
<td>{{artist.num_albums}}</td>
<td>{{artist.last_album}}</td>
<td>{{artist.top_track}}</td>
</tr>
{% endfor %}
</table>
</div>
The obvious disconnect seems to be the fact that I am using the templating rather than ng-repeat. However is there a way that I can add these artist html elements to the model after the fact rather than using ng-repeat?
Here is my "ArtistTableCtrl" controller that I have defined...
/* Controllers */
var sweetMusicApp = angular.module('sweetMusicApp', []);
sweetMusicApp.controller('ArtistTableCtrl', function($scope){
console.log($scope.artist);
console.log($scope);
});
and the console output (unsuprisingly)...
undefined
b {$$childTail : null, $$childHead: null, $$nextSibling:null,
$$watchers: null, $$listeners:Object...}