Vote count: 0 im using angular2 version 2.0.0-rc.5 and i create a file name userdetails.ts import {Injectable} from '@angular/core'; export interface userdetails{ userid: string, password: string, name: string, sbu: string, division: string, position:string, loggedin:boolean } @Injectable() export class Userdetails implements userdetails { public userid: string = null; public password: string = null; public name: string = null; public sbu: string = null; public division: string = null; public position: string = null; public loggedin: boolean = false; constructor(){ } isLoggedin(){ retu this.loggedin; } userSBUdetails(){ retu this.sbu; } getUserdetails(){ retu {userid: this.userid, password: ...
ادامه مطلبVote count: 0 I'm trying to bootstrap my Angular 2 RC5 application following this guide https://angular.io/docs/ts/latest/guide/ngmodule.html Below is my code import { AppModuleNgFactory } from './app.module.ngfactory'; import {platformBrowser} from "@angular/platform-browser"; platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); However , when I tried to compile typescript code, I got the following error appmain.ts(1,36): error TS2307: Caot find module './app.module.ngfactory'. How can I generate the app.module.ngfactory file? Which tool should I use? asked 1 min agoToan Nguyen Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am working on getting an app set up using Angular 2 w/ typescript and I'm having issues getting my karma coverage to find the files I want it to inspect. I've set this up successfully on an angular 1.x application but there seems to be another layer I'm missing with typescript. Everything runs just fine, I see all of my unit tests being checked by karma as expected and coverage says everything was okay and that my code has 100% coverage, which threw up a red flag. After checking the html output for coverage I saw that I have 100% coverage because no files are being checked. Looking at the output in my terminal I see that all of the files I have selected with patte: './src/**/...
ادامه مطلبVote count: 0 in Angular 2 project written in typescript and packaged with webpack I add e.g. following throw to welcome.ts file: @Page({ templateUrl: 'build/views/welcome/welcome.html' }) export class Welcome{ constructor(){ throw('something went wrong') } } In JS console, I see following error and stacktrace: EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error during instantiation of Welcome!. ORIGINAL EXCEPTION: something went wrong ERROR CONTEXT: [object Object]BrowserDomAdapter.logError @ browser_adapter.js?f9d6:77 BrowserDomAdapter.logGroup @ browser_adapter.js?f9d6:87 ExceptionHandler.call @ exception_handler.js?1ee2:57 (anonymous function) @ application_ref.js?7cf8:194 EventEmi...
ادامه مطلبVote count: 0 I am looking for sample on Angular2 RC with typescript and ASP.NET web api 2 integration for CURD operations. Please share if anyone already tried this sample. Cheers Sanket asked 2 mins agoSanket Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am trying to get up and ruing with Angular 2 and typescript. So far so good, but I am having some troubles to get a Facebook login message working. I found a project on github that demonstrated how this can be done. In this example, they have the following coector: fbcoector.ts export class FBCoector { constructor(appID: string) { if (!window.fbAsyncInit) { console.log('define'); window.fbAsyncInit = function() { FB.init({ appId: appID, xfbml: true, version: 'v2.5' }); }; } } initFB() { var js: any, id = 'facebook-jssdk', ref = document.getElementsByTagName('script')[0]; if (document.getElementById(id)) { retu; } js = document.createElement('script'); js.id = id; js.async = t...
ادامه مطلبVote count: 0 So I'm looking at an ionic 2 project which is using Angular 2 and Typescript and am a bit confused about how member properties are set. Looking at the example below, Angular automatically injects the dependencies in the constructor arguments. In the case of nav, we are explicitly setting the instance member nav to what's being passed in by the constructor. In the case of Firebase auth, we don't explicitly set it to a member variable, but we can still access it via this.auth, how come? if we try the same thing with this.nav it won't work unless we explicitly set the instance variable. What does using the private keyword do in the constructor parameters do - is it redundant to de...
ادامه مطلبVote count: 0 I'm trying to retu information from my api but I don't understand how to correctly use subscribe. With an array I retu an empty array from my service and push values into it as I get them. How would I correctly retu just a single value variable in app-component ts. Right now If I do a alert(JSON.stringify(authenticated)) it just gives me {"_isUnsubscribed":false,"_subscriptions":[{"isUnsubscribed":false}]} app-component ts checkAuthentication(){ var authenticated = this._authService.getAuthenication(); } authentication Service getAuthenication() { retu this._http.get('auth.php').subscribe(res => { if (res.json().authenticated === true){ retu true; } retu false; }); } auth.php a...
ادامه مطلب