只有当我刷新网址时,Angularjs才会推送工作

时间:2015-05-07 15:16:08

标签: javascript angularjs-scope

我想在我的视图中推送一个元素,问题是只有当我刷新网址时元素才出现在视图中。 这是功能:

$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);
         )
     }

html:

<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()" />

0 个答案:

没有答案