我想在我的视图中推送一个元素,问题是只有当我刷新网址时元素才出现在视图中。 这是功能:
$scope.add = function(index) {
$scope.projects = [];
function puts(error, stdout, stderr) {
console.log(error, stdout, stderr);
if (error == null) {
$scope.db.insert('project', {
"idProject": $scope.idProject,
"name": $scope.ProjectName,
'path': directory
}).
then(function(results) {
$scope.projects.push({
"idProject": idp,
"name": namep,
'path': directory
});
}
exec(" cd " + "path", puts);
)
}
<a style="background: #AFAFAF"> <i ng-click="remove(project.id)" class="fa fa-fw fa-trash-o"></i> {{project.name}}</a>
<input class="btn btn-primary" ng-click="add()" />