Jump to content

Search the Community

Showing results for tags 'angular 2'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Q&A Desenvolvimento
    • Perguntas e respostas rápidas
  • Desenvolvimento e Banco de Dados
    • HTML e CSS
    • Java
    • Javascript
    • .NET
    • PHP
    • Python
    • Ruby
    • Mobile
    • Ambientes de Desenvolvimento
    • Arquitetura e Métodos Ágeis
    • Banco de Dados
    • DevOps
    • Desenvolvimento de Games
    • E-Commerce e Pagamentos Online
    • SEO e Otimizações
    • WordPress
    • Algoritmos & Outras Tecnologias
  • Design e Produto
    • Fotografia
    • Photoshop
    • Design de interfaces e UX
    • Edição/Produção de Vídeos
    • Marketing Online
    • Desenho, Ilustração e 3D
  • Entretenimento e uso pessoal
    • Geral
    • Segurança & Malwares
    • Gadgets e wearable
    • Softwares e Apps
    • Entretenimento

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Google+


Hangouts


Skype


Twitter


deviantART


Github


Flickr


LinkedIn


Pinterest


Facebook


Site Pessoal


Localização


Interesses

Found 1 result

  1. Henrique Buzin

    Angular 2 e PHP

    Olá, Sou iniciante em angular 2, estou desenvolvendo uma aplicação utilizando Angular 2 e PHP, mas quando tendo pegar os valores do json dá erro: ERROR Error: Error trying to diff 'Grand Turismo'. Only arrays and iterables are allowed e ERROR CONTEXT DebugContext_ {view: Object, nodeIndex: 23, nodeDef: Object, elDef: Object, elView: Object}. Este é o back-end, está bem simples: <?php use \Psr\Http\Message\ServerRequestInterface as Request; use \Psr\Http\Message\ResponseInterface as Response; header("Access-Control-Allow-Origin: *"); require 'vendor/autoload.php'; $app = new \Slim\App; $app->get('/games', function (Request $request, Response $response){ $games = array(); $games = array( "name" => "Grand Turismo", "category" => "PS4", "price" => "199.99", "quantity" => "8", "production" => "true", "description" => "Eleito o melhor jogo de corrida." ); return json_encode($games); }); $app->run(); ?> app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { PopupModule } from 'ng2-opd-popup'; import { AppComponent } from './app.component'; import { FooterComponent } from './footer/footer.component'; import { HeaderComponent } from './header/header.component'; import { GamesListingComponent } from './listing/games/games-listing.component'; import { PlatformsListingComponent } from './listing/platforms/platforms-listing.component'; import { routing } from './app.routes'; import 'rxjs/add/operator/map'; @NgModule({ declarations: [ AppComponent, PlatformsListingComponent, FooterComponent, HeaderComponent, GamesListingComponent ], imports: [ BrowserModule, FormsModule, HttpModule, routing, HttpModule, PopupModule.forRoot() ], bootstrap: [AppComponent] }) export class AppModule { } games-listing.component.ts import { Component } from '@angular/core'; import { Http } from '@angular/http'; import {Popup} from 'ng2-opd-popup'; @Component({ moduleId: module.id, selector: 'app-games-listing', templateUrl: './games-listing.component.html', styleUrls: ['./games-listing.component.css'] }) export class GamesListingComponent{ games: Object[] = []; constructor(http: Http, private popup:Popup){ http.get('http://localhost:80/lightning/server/index.php/games') .map(res => res.json()).subscribe(games => { this.games = games; console.log(this.games); }), erro => console.log(erro); } ClickButton(){ this.popup.options = { header: "Your custom header", color: "#5cb85c", // red, blue.... widthProsentage: 40, // The with of the popou measured by browser width animationDuration: 1, // in seconds, 0 = no animation showButtons: true, // You can hide this in case you want to use custom buttons confirmBtnContent: "OK", // The text on your confirm button cancleBtnContent: "Cancel", // the text on your cancel button confirmBtnClass: "btn btn-default", // your class for styling the confirm button cancleBtnClass: "btn btn-default", // you class for styling the cancel button animation: "fadeInDown" // 'fadeInLeft', 'fadeInRight', 'fadeInUp', 'bounceIn','bounceInDown' }; this.popup.show(this.popup.options); } YourConfirmEvent(){ alert('You cliked confirm'); } YourCancelEvent(){ alert('You cliked cancel'); } } games-listing.component.html <table class="table table-striped"> <thead> <tr> <th>Nome</th> <th>Categoria</th> <th>Fabricante</th> <th>Ver mais...</th> </tr> </thead> <tbody> <tr *ngFor="let game of games"> <td>{{game.name}}</td> <td></td> </tr> </tbody> </table> Se precisar de algum outro código, só avisar que passo. Agradeço desde já.
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.