angular2-services

Property 'includes' is missing in type 'Subscription' -angular2

心不动则不痛 提交于 2019-12-23 03:34:14
问题 I have been trying to get an array of objects from node to a service onInit and assign it to component. I am able to view data in service but when i try to assign to a variable in component, I get below error. I have included my code as well. Please favour on this.All i need is to just take that array from service and assign it to finallist in component. ERROR in C:/Users/girija/Documents/animapp/src/app/components/list.component.ts (28,5): Type 'Subscription' is not assignable to type 'any[]

How to do FULL SCREEN WINDOW functionality while clicking the button in Angular 2?

可紊 提交于 2019-12-23 03:31:47
问题 I have created the login page for the user. If They click the submit button, the page will navigate to one component (test.component.ts,test.component.html,..). I need to make that window in full screen mode. like, (video control full screen in html5). submitLogin() { if (this.userName === 'Student' && this.passWord === 'student@123'){ this.dashboard = true; } else { alert('Incorrect Username or Password'); } } I don't know how to achieve the full screen window functionality. Because, i am

Angular2: Dependencies Between Apps created with angular-cli

◇◆丶佛笑我妖孽 提交于 2019-12-23 03:01:25
问题 I am using the Angular2-cli to create two applications: MyFirstApp & MySecondApp . I whish MySecondApp to import MyFirstApp so I can reuse directive/service/component. When I import MyFirstApp , I have the following compilation error: Cannot find module 'MyFirstApp' . Here's how to reproduce : $ npm -v 3.9.3 $ node -v v6.2.1 $ npm list | grep 'angular' ├── @angular/common@2.0.0-rc.1 ├── @angular/compiler@2.0.0-rc.1 ├── @angular/core@2.0.0-rc.1 ├── @angular/http@2.0.0-rc.1 ├── @angular

Angular2: Dependencies Between Apps created with angular-cli

眉间皱痕 提交于 2019-12-23 03:01:20
问题 I am using the Angular2-cli to create two applications: MyFirstApp & MySecondApp . I whish MySecondApp to import MyFirstApp so I can reuse directive/service/component. When I import MyFirstApp , I have the following compilation error: Cannot find module 'MyFirstApp' . Here's how to reproduce : $ npm -v 3.9.3 $ node -v v6.2.1 $ npm list | grep 'angular' ├── @angular/common@2.0.0-rc.1 ├── @angular/compiler@2.0.0-rc.1 ├── @angular/core@2.0.0-rc.1 ├── @angular/http@2.0.0-rc.1 ├── @angular

Angular: Some routes use PathLocationStrategy but some other routes use HashLocationStrategy

ぐ巨炮叔叔 提交于 2019-12-23 02:25:08
问题 I have 4 routes in my app.routes. import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; export const pageRoutes: Routes = [ {path: '', redirectTo: 'home', pathMatch: 'full'}, {path: 'home', component: HomeComponent}, {path: 'transaction', loadChildren: './app/transaction.module#TransactionModule'}, {path: 'evidence', loadChildren: './app/evidence.module#EvidenceModule'} ]; @NgModule({ imports: [RouterModule.forRoot(pageRoutes)], exports:

Angular - inject in other way than constructor?

别等时光非礼了梦想. 提交于 2019-12-22 18:17:38
问题 In Angular, I have a service that has few things injected through the constructor(...) . However that service is also at some place created by calling the constructor. Therefore, adding another service it depends on to the parameters would change the API. I'd like to avoid that. Is there a way to inject a service into another service without adding it to the constructor parameters? E.g. field injection? import {Inject, Injectable} from "@angular/core"; import { Http, Request,

Angular2 http observables - how to work with undefined type

岁酱吖の 提交于 2019-12-22 13:09:42
问题 I am migrating some code from Angular1 to Angular2 and having a few issues. I can open a json response, populate a template, and access data from template ng functions but have not been able to access the data directly from the component class. From what I have read and the error messages seen Angular2 http / observable does not seem to return a pure json object, so I suspect I need to remap it, but not sure how. I believe it should also be possible to drop back to promises using onPromise

Angular 2 “No provider for String!”

怎甘沉沦 提交于 2019-12-22 12:58:56
问题 I'm trying to create a generalized data service in Angular 2, and I'm encountering a strange error. Essentially, I'm creating an HTTP service whose methods take in part of the api url so that I can use it for multiple cases. For example, I would like to pass in 'projects/' and join it with 'api/' to get 'api/projects/' which I could then use in the http calls. My current dataService.ts: import { Injectable } from '@angular/core'; import { Http, Response, Headers } from '@angular/http'; import

Angular2 router with Http data service through a Resolve with Observable catching 404

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 12:14:46
问题 In my resolve guard I am getting an Http Observable to return the JSON of a user from a particular id . I want to catch an error and reroute to the users overview if the id does not exist. I have seen code that solves that with a Promise, but not with an Observable. I would like to see a solution with an Observable! Currently I get an "EXCEPTION: Uncaught (in promise): Response with status: 404 Not Found for URL: http://127.0.0.1:3000/users/191" since user 191 does not exsist. Here is my code

Angular 2 - background image into a html file using ngStyle

自作多情 提交于 2019-12-22 11:57:50
问题 I am pulling data from an API using an Angular 2 service.. I can output everything from the json api onto the page using something similar to this {{ project.title }} however i wish to output the url to a background image and I cant seem to get it working.. has anyone got any ideas or advice ? Currently this is what I have. I've tried it without the curly braces also but nothing is working. <div class="table-wrap featuredimg" [ngStyle]="{'background-image': 'url(' + {{ project.projectimage }}