使用ng-click AngularJS推送$ scope

时间:2016-11-11 12:09:09

标签: javascript angularjs

我希望用户按下$ scope.getJobList按钮以获取$ scope.getIdJobs变量的值。我试图通过推送功能解决这个问题,但它无法正常工作。 我做错了吗?

jsfidle

实施例

$scope.getIdJobs = function(getIdJobs) {   

    $scope.getIdJobs = $filter('filter')( $scope.products, {id:getIdJobs})[0];

         $scope.getJobList = function(currObj){
                $scope.workflows[0].Steps.push($scope.getIdJobs); // It will add a new step ($scope.newStep) in first workflow's Steps
                console.log($scope.workflows);
            //$scope.workflows.push($scope.getIdJobs); // line that changed
            $scope.workflows = job_detail.addJob(currObj)
            console.log($scope.workflows);
        };

    //console.log("Estou dentro do getidJobs " + getIdJobs);
}

HTML

       <article dir-paginate="product in filteredJobs | filter:searchTerm | orderBy: sorting.order:sorting.direction | itemsPerPage:5" id="{{product.id}}" class="productlist product col-sm-12"> 
            <div class="inner-content">
                <div class="clearfix">                       
                    <div class="col-md-8 col-sm-8 col-xs-8">
                        <h4 class="productname" name="{{product.Categoria}}"><a data-ng-href="#/job/{{product.id}}" ng-click="getIdJobs(product.id)">{{product.Title}}</a></h4>
                        <!--<h4 class="productname" name="{{product.Categoria}}"><a data-ng-href="#/job/{{filteredJobs.indexOf(product)}}">{{product.Title}}</a></h4>-->
                        <h4 style="color: gray;"><a data-ng-href="#/empresa">{{product.Empresa}}</a></h4>

                    </div>                        

                </div>
            </div>
        </article>

0 个答案:

没有答案