Hi guys!!!
I am trying to read a JSON file with "File System nodejs module", right now
everything is working fine but the UI doesn't refresh the output until I
click "Parse File" button two times.
I am running the project using node-webkit on MacOSx 10.9.5
Here my JS code:
$scope.parseJSONFile = function() {
var fs = require('fs');
var file = $scope.filePath;
fs.readFile(file, 'utf8', function (err, data) {
try {
$scope.jsonParsed = JSON.parse(data.toString());
console.log(data.toString());
}
catch(err) {
alert("Invalid file, please verify file structure");
}
});
};
Here my HTML code:
Path: <input type="text" ng-model="filePath">
<button ng-click="parseJSONFile()">Parse File</button>
JSON: {{ jsonParsed }}
Actually I can see the right output thought the log:
[9617:0219/153611:INFO:CONSOLE(32)] ""{\n \"name\": \"nw-demo\",\n
\"main\": \"index.html\"\n}""
I really appreciate your help
Gustavo
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.