Angular-Interview-Questions
Angular-Interview-Questions copied to clipboard
I will get data from my nested json file with httpclient and i have a problem
import { Component, OnInit } from '@angular/core'; import { RecordsService } from './records.service'; // tslint:disable-next-line:import-blacklist import { map } from 'rxjs/operators'; import {Observable} from 'rxjs'; import { ArrayType } from '@angular/compiler'; // tslint:disable-next-line:prefer-const export interface RootObject { data: Data; } export interface Data { altMenuListe: AltMenuListe2[]; } export interface AltMenuListe2 { ustMenuId: number; menuAd: string; isLeaf: boolean; leaf: number; altMenuListe: AltMenuListe[]; } export interface AltMenuListe { ustMenuId: number; menuAd: string; isLeaf: boolean; leaf: number; altMenuListe: any[]; } @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { records: any; title = 'Angular Rest Api Test'; // tslint:disable-next-line:use-life-cycle-interface constructor(private myFirstService: RecordsService) { } // tslint:disable-next-line:use-life-cycle-interface ngOnInit() { this.myFirstService.getData() .subscribe(dataS => { this.records = dataS.data; console.log(this.records); }); } } this is my service.ts Hide Copy Code import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Data } from './app.component'; import { AltMenuListe2 } from './app.component'; import { AltMenuListe } from './app.component'; import { RootObject } from './app.component'; @Injectable() export class RecordsService { constructor(private http: HttpClient) {} getData() { return this.http.get('http://192.168.12.10:8088/sistemApi/menuGetir?_dc=1534489724075'); } } this is my json Hide Expand Copy Code { "okundu" : "okunmadi", "degisti" : "", "menuId" : null, "ustMenuId" : null, "projeFormId" : null, "menuSira" : null, "menuKod" : null, "menuAd" : "I-DEAL Menü", "menuSimge" : null, "menudeTiklan" : null, "menuFavori" : null, "isLeaf" : null, "leaf" : null, "versionId" : null, "icon" : null, "altMenuListe" : null, "altMenu" : [ { "okundu" : "okunmadi", "degisti" : "", "menuId" : 1, "ustMenuId" : 0, "projeFormId" : null, "menuSira" : 11, "menuKod" : null, "menuAd" : "Sistem Yönetimi", "menuSimge" : "fa-cogs", "menudeTiklan" : false, "menuFavori" : false, "isLeaf" : false, "leaf" : 0, "versionId" : 2, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/klasor.jpg", "altMenuListe" : null, "altMenu" : [ { "okundu" : "okunmadi", "degisti" : "", "menuId" : 321, "ustMenuId" : 1, "projeFormId" : 1, "menuSira" : 1, "menuKod" : "sistem.bilgisayar.BilgisayarView", "menuAd" : "Bilgisayar Kayıtları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 335, "ustMenuId" : 1, "projeFormId" : 3, "menuSira" : 4, "menuKod" : "sistem.bolge.BolgeView", "menuAd" : "Bölge Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 342, "ustMenuId" : 1, "projeFormId" : 24, "menuSira" : 5, "menuKod" : "sistem.menukayit.MenuKayitTree", "menuAd" : "Ağaç Menu Düzenleme", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 348, "ustMenuId" : 1, "projeFormId" : 30, "menuSira" : 6, "menuKod" : "sistem.kullaniciyetki.KullaniciYetkiView", "menuAd" : "Kullanıcı Yetki Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 352, "ustMenuId" : 1, "projeFormId" : 34, "menuSira" : 2, "menuKod" : "sistem.guncelle.SistemGuncelleForm", "menuAd" : "Sistem Güncelle", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 353, "ustMenuId" : 1, "projeFormId" : 35, "menuSira" : 7, "menuKod" : "sistem.menukayit.MenuKayitView", "menuAd" : "Sistem Form Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 395, "ustMenuId" : 1, "projeFormId" : 89, "menuSira" : 9, "menuKod" : "sistem.yazici.YaziciView", "menuAd" : "Anket Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 412, "ustMenuId" : 1, "projeFormId" : 105, "menuSira" : 10, "menuKod" : "cvBankasi.CvForm.CvView", "menuAd" : "CV Tanımlama", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 417, "ustMenuId" : 1, "projeFormId" : 111, "menuSira" : 3, "menuKod" : "sistem.yonetim.ProjeAyarlari", "menuAd" : "Proje Parametre Ayarları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 493, "ustMenuId" : 1, "projeFormId" : 239, "menuSira" : 11, "menuKod" : "sistem.cariYilDonem.CariYilDonemView", "menuAd" : "Cari Yıl Dönem Formu", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 504, "ustMenuId" : 1, "projeFormId" : 255, "menuSira" : 12, "menuKod" : "DealKurulumView", "menuAd" : "Deal Kurulumları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 513, "ustMenuId" : 1, "projeFormId" : 264, "menuSira" : 13, "menuKod" : "sistem.etiket.EtiketView", "menuAd" : "Etiket Form", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 662, "ustMenuId" : 1, "projeFormId" : 50, "menuSira" : 8, "menuKod" : "stok.stokRecete.StokReceteView", "menuAd" : "Stok Reçete Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 674, "ustMenuId" : 1, "projeFormId" : 343, "menuSira" : 18, "menuKod" : "stok.cikisIslemleri.BirimKapatForm", "menuAd" : "Birim Kapat", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 675, "ustMenuId" : 1, "projeFormId" : 345, "menuSira" : 14, "menuKod" : "sistem.birim.BirimGunKontrolView", "menuAd" : "Birim Gün Saat Kontrolleri", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 710, "ustMenuId" : 1, "projeFormId" : 389, "menuSira" : 15, "menuKod" : "portal.kimlikGrup.SohbetGrupView", "menuAd" : "Sohbet Kimlik Grup Tanımları ", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 0, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] } ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 2, "ustMenuId" : 0, "projeFormId" : null, "menuSira" : 9, "menuKod" : null, "menuAd" : "Kullanıcı Yönetimi", "menuSimge" : "fa-users", "menudeTiklan" : false, "menuFavori" : false, "isLeaf" : false, "leaf" : 0, "versionId" : 1, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/klasor.jpg", "altMenuListe" : null, "altMenu" : [ { "okundu" : "okunmadi", "degisti" : "", "menuId" : 322, "ustMenuId" : 2, "projeFormId" : 5, "menuSira" : 1, "menuKod" : "kullanici.kullaniciGrup.KullaniciGrupView", "menuAd" : "Kullanıcı Grup Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 1, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 435, "ustMenuId" : 2, "projeFormId" : 6, "menuSira" : 2, "menuKod" : "kullanici.kullaniciRol.KullaniciRolView", "menuAd" : "Kullanıcı Rol Tanımları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 1, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] }, { "okundu" : "okunmadi", "degisti" : "", "menuId" : 436, "ustMenuId" : 2, "projeFormId" : 4, "menuSira" : 3, "menuKod" : "kullanici.kullaniciMain.KullaniciMainView", "menuAd" : "Kullanıcı Kayıtları", "menuSimge" : null, "menudeTiklan" : true, "menuFavori" : false, "isLeaf" : true, "leaf" : 1, "versionId" : 1, "icon" : "http://localhost:8080/dealResources/images/simge/16x16/form.jpg", "altMenuListe" : null, "altMenu" : [ ] } ] } } ] } ] }
is there anybody help me?
What error are you getting?
i developed a app in angular 6 and fetch data from nested json from httpclient but when i run app my model is empty i sent my app.cpmponent.ts , service.ts , json to you please check it
On Mon, Aug 20, 2018 at 3:11 AM Bhanu Chamakuri [email protected] wrote:
What error are you getting?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Yonet/Angular-Interview-Questions/issues/29#issuecomment-414166080, or mute the thread https://github.com/notifications/unsubscribe-auth/AHarKCsrkhlH4e8r7Gk2Mlzabe8QcRDsks5uSf6_gaJpZM4WCnA4 .
Have you added your service in Providers section in app.module.ts?
Yes I got data actually just I got header of json I think my app.component.ts has problem
On 08:06, Mon, Aug 20, 2018 Bhanu Chamakuri [email protected] wrote:
Have you added your service in Providers section in app.module.ts?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Yonet/Angular-Interview-Questions/issues/29#issuecomment-414198413, or mute the thread https://github.com/notifications/unsubscribe-auth/AHarKA12VLnPrp4AiROPNFqCwNwiJyJoks5uSkPCgaJpZM4WCnA4 .
When I run app doesn't bring all data bring on data
On 08:06, Mon, Aug 20, 2018 Bahmani 1973 [email protected] wrote:
Yes I got data actually just I got header of json I think my app.component.ts has problem
On 08:06, Mon, Aug 20, 2018 Bhanu Chamakuri [email protected] wrote:
Have you added your service in Providers section in app.module.ts?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Yonet/Angular-Interview-Questions/issues/29#issuecomment-414198413, or mute the thread https://github.com/notifications/unsubscribe-auth/AHarKA12VLnPrp4AiROPNFqCwNwiJyJoks5uSkPCgaJpZM4WCnA4 .
actually my app is working just doesn't bring full data