Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

problema no angular

$
0
0

não estou a conseguir mostar numa label quando carrego no butão ver

segue-se o codigo

script

var app = angular.module('myApp', ['ui.bootstrap']);
 
app.filter('startFrom', function() {
 return function(input, start) {
 if(input) {
 start = +start; //parse to int
 return input.slice(start);
 }
 return [];
 }
});
app.controller('customersCrtl', function ($scope, $http, $timeout) {
 $http.get('app/projectos.php').success(function(data){
 $scope.list = data;
 $scope.currentPage = 1; //current page
 $scope.entryLimit = 5; //max no of items to display in a page
 $scope.filteredItems = $scope.list.length; //Initially for no filter
 $scope.totalItems = $scope.list.length;
$scope.editUser = function(id) {
  if (id == 'new') {
    $scope.edit = true;
    $scope.incomplete = true;
    $scope.nome = '';
    //$scope.lName = '';
    } else {
    $scope.edit = false;
    $scope.list = $data[id-1].nome;
    //$scope.lName = $scope.users[id-1].lName;
  }
}
 });
 $scope.setPage = function(pageNo) {
 $scope.currentPage = pageNo;
 };
 $scope.filter = function() {
 $timeout(function() {
 $scope.filteredItems = $scope.filtered.length;
 }, 10);
 };
 $scope.sort_by = function(predicate) {
 $scope.predicate = predicate;
 $scope.reverse = !$scope.reverse;
 };
 
});

projecto.php

<div class="row">
    <div class="col-md-12" ng-show="filteredItems > 0">
        <table class="table table-striped table-bordered">
        
        <thead >
         <th>Ver</th>
        <th>Nome do Projecto <a ng-click="sort_by('nome');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Descrição <a ng-click="sort_by('descricao');"><i class="glyphicon glyphicon-sort"></i></a></th>
       <th>Categoria <a ng-click="sort_by('categoria');"><i class="glyphicon glyphicon-sort"></i></a></th>
    <!--  <th>Postal Code <a ng-click="sort_by('postalCode');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Country <a ng-click="sort_by('country');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Credit Limit <a ng-click="sort_by('creditLimit');"><i class="glyphicon glyphicon-sort"></i></a></th>
     -->
        </thead>
        <tbody>
            <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
             <td>   <button class="btn" ng-click="editUser(data.idprojecto)">
          <span class="glyphicon glyphicon-search"></span>  Ver
        </button></td>
                <td>{{data.nome}}</td>
                <td>{{data.descricao}}</td>
         
                <td>{{data.categoria}}</td>
            
            </tr>
        </tbody>
        </table>
       <form class="form-horizontal">
<div class="form-group">
  <label class="col-sm-2 control-label"  ng-model="nome">First Name: {{data.nome}}</label>
  </div>
</form> 
    </div>
    <div class="col-md-12" ng-show="filteredItems == 0">
        <div class="col-md-12">
            <h4>Nenhum projecto Adecionado</h4>
        </div>
    </div>

Viewing all articles
Browse latest Browse all 14190

Latest Images

Trending Articles