I am building my first ever website in angularJs
. Currently, trying to load a table using the following code
$scope.voyages = [
{
"data1": "data",
"data2": "data
}, {
"data1": "data",
"data2": "data
}];
but I want to put the data from my file.json
into this table, how can I do it?
I've tried the getJson function of jQuery but had no success, I might not be using it the correct or recommended way.
EDIT : Fixed it like this :
function VoyagesCtrl($scope) {
$scope.voyages= $.get( "file.json", function(data){
$scope.voyages = JSON.parse(data);
console.log($scope.voyages);
});
}