Base solution for your next web application

Activities of "affern"

Thank you so much, @ismcagdas!!! This was so nice to get resolved :)) Thanks again for your great service.

Hi @ismcagdas. Have you had time to take a look at my project?

Hi @ismcagdas Of course. I have sent it to you. Thank you for your service.

Hi @ismcagdas Thanks for your reply. Yes, i have followed these steps. I have tried 3-4 times now with the same result: It compiles, but I get a lot of errors in the browser, telling me that all my service calls returns null. I belive it is something with the rxjs update, but I'm not sure because I have followed all the descriptions with running these steps: -npm install -g rxjs-tslint -rxjs-5-to-6-migrate -p src/tsconfig.json -and changed all my finally statements with .pipe(finalize..

I have verified that all my api calls work.

I guess I should leave my aspnet-zero-template version = 4.0.0 in package.json? My service.config.nswag does'nt update the javascript references from my package.json so I have to do this manually. What can be the reason for that?

Hi again.

It seems like a difficult task to do this upgrade. I have been working for several weeks with this.

I have now upgraded to ABP v3.8.1. But I'm not sure which dependencies the APNetZero Angular will have for Angular 6. I haven't managed to find any information on how to upgrade to Angular 6. My abp-zero-template version is 4.0. Should i keep this on version 4 or should i upgrade? Is there any page for this module? I found only this https://www.npmjs.com/package/abp-zero-template, but only show 1 version.

I have found this AspNetZero project which use Angular 6: https://github.com/aspnetzero/aspnet-zero-core/tree/publish-issues/angular Here is "abp-ng2-module": "^3.1.0 and abp-web-resources": "^3.7.0". Is this version related to Angualar 6? Should I update to this version? I have tried, but get a lot of bugs. So I have started all over again.

According to this page: https://www.npmjs.com/package/abp-ng2-module/v/3.1.0, abp-ng2-module 3.1.0 version have among others, Dev dependencies copyfiles, rimraf and rollup.
What packages do i have to install to get these dependencies?

Thank you for the link to releases. It is useful. Is there any other pages I can find information on how to upgrade the APNetZero Angular project?

My ABP project v3.8.1 compiles and run fine with my Angular 5 project. My Angular 6 project comiles and render start page. But without data. All my service calls returns null. I don't see any errors in the log file.

But I can see my service-proxies.ts is not updated.

I expect the head of it should look like this: import { mergeMap as _observableMergeMap, catchError as _observableCatch } from 'rxjs/operators'; import { Observable, from as _observableFrom, throwError as _observableThrow, of as _observableOf } from 'rxjs'; import { Injectable, Inject, Optional, InjectionToken } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpResponseBase, HttpErrorResponse } from '@angular/common/http';

import * as moment from 'moment';

export const API_BASE_URL = new InjectionToken<string>('API_BASE_URL');

But I get this:

/* tslint:disable */ //---------------------- // <auto-generated> // Generated using the NSwag toolchain v11.12.16.0 (NJsonSchema v9.10.19.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org) // </auto-generated> //---------------------- // ReSharper disable InconsistentNaming

import 'rxjs/add/observable/fromPromise'; import 'rxjs/add/observable/of'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; import 'rxjs/add/operator/mergeMap'; import 'rxjs/add/operator/catch';

import { Observable } from 'rxjs/Observable'; import { Injectable, Inject, Optional, InjectionToken } from '@angular/core'; import { Http, Headers, ResponseContentType, Response } from '@angular/http';

import * as moment from 'moment';

export const API_BASE_URL = new InjectionToken<string>('API_BASE_URL');

@Injectable() export class AccountServiceProxy { private http: Http; private baseUrl: string; protected jsonParseReviver: (key: string, value: any) => any = undefined;

constructor(@Inject(Http) http: Http, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
    this.http = http;
    this.baseUrl = baseUrl ? baseUrl : "";
}

/**
 * @input (optional) 
 * @return Success
 */
isTenantAvailable(input: IsTenantAvailableInput): Observable&lt;IsTenantAvailableOutput&gt; {
    let url_ = this.baseUrl + "/api/services/app/Account/IsTenantAvailable";
    url_ = url_.replace(/[?&]$/, "");

    const content_ = JSON.stringify(input);

    let options_ : any = {
        body: content_,
        method: "post",
        headers: new Headers({
            "Content-Type": "application/json", 
            "Accept": "application/json"
        })
    };

...........................

Why do I miss import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpResponseBase, HttpErrorResponse } from '@angular/common/http'; ? What is controlling this?

My browser display many errors like this: core.js:1673 ERROR TypeError: Cannot read property 'length' of undefined at SafeSubscriber._next (footer-public.component.ts:70) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:253) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:191) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:129) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93) at CatchSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:129) at CatchSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber.notifyNext (mergeMap.js:136) at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/InnerSubscriber.js.InnerSubscriber._next (InnerSubscriber.js:20) at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93) at subscribeTo.js:16 at subscribeToResult (subscribeToResult.js:6) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._innerSub (mergeMap.js:127) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._tryNext (mergeMap.js:124) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._next (mergeMap.js:107)

Yes angular service proxies. I'm refreshing the proxies with nswag, but it does not help.

I bought it in july 2017 and have upgraded my ANZ solution. My ABP nugetpackages is on 3.3 version and solution is running .Net Core 2.1. It is working fine with Angular 5, but not after I upgraded to Angular 6. Is service.config.nswag updating from ANZ solution or should I change values myself? The last version on ABP nugetpackages is 4.7, but it have some breaking changes, so i stopped on 3.3. But maybe I need higher version for Angular 6?

I changed some settings manually in my service.config.nswag file:

{ "runtime": "Default", "defaultVariables": null, "swaggerGenerator": { "fromSwagger": { "url": "http://localhost:22742/swagger/v1/swagger.json", "output": null } }, "codeGenerators": { "swaggerToTypeScriptClient": { "className": "{controller}ServiceProxy", "moduleName": "", "namespace": "", "typeScriptVersion": 2.0, "template": "Angular", "promiseType": "Promise", "httpClass": "HttpClient", "useSingletonProvider": false, "injectionTokenType": "InjectionToken", "rxJsVersion": 6.0, "dateTimeType": "MomentJS", "nullValue": "Undefined", "generateClientClasses": true, "generateClientInterfaces": false, "generateOptionalParameters": false, "exportTypes": true, "wrapDtoExceptions": false, "clientBaseClass": null, "wrapResponses": false, "wrapResponseMethods": [], "generateResponseClasses": true, "responseClass": "SwaggerResponse", "protectedMethods": [], "configurationClass": null, "useTransformOptionsMethod": false, "useTransformResultMethod": false, "generateDtoTypes": true, "operationGenerationMode": "MultipleClientsFromPathSegments", "markOptionalProperties": false, "generateCloneMethod": true, "typeStyle": "Class", "classTypes": [], "extendedClasses": [], "extensionCode": null, "generateDefaultValues": true, "excludedTypeNames": [], "excludedParameterNames": [], "handleReferences": false, "generateConstructorInterface": true, "convertConstructorInterfaceData": false, "importRequiredTypes": true, "useGetBaseUrlMethod": false, "baseUrlTokenName": "API_BASE_URL", "queryNullValue": "", "inlineNamedDictionaries": false, "templateDirectory": null, "typeNameGeneratorType": null, "propertyNameGeneratorType": null, "enumNameGeneratorType": null, "serviceHost": null, "serviceSchemes": null, "output": "../src/shared/service-proxies/service-proxies.ts" }, "swaggerToCSharpClient": { "clientBaseClass": null, "configurationClass": null, "generateClientClasses": true, "generateClientInterfaces": false, "injectHttpClient": false, "disposeHttpClient": true, "protectedMethods": [], "generateExceptionClasses": true, "exceptionClass": "SwaggerException", "wrapDtoExceptions": true, "useHttpClientCreationMethod": false, "httpClientType": "System.Net.Http.HttpClient", "useHttpRequestMessageCreationMethod": false, "useBaseUrl": true, "generateBaseUrlProperty": true, "generateSyncMethods": false, "exposeJsonSerializerSettings": false, "clientClassAccessModifier": "public", "typeAccessModifier": "public", "generateContractsOutput": false, "contractsNamespace": null, "contractsOutputFilePath": null, "parameterDateTimeFormat": "s", "generateUpdateJsonSerializerSettingsMethod": true, "serializeTypeInformation": false, "queryNullValue": "", "className": "{controller}Client", "operationGenerationMode": "MultipleClientsFromOperationId", "additionalNamespaceUsages": [], "additionalContractNamespaceUsages": [], "generateOptionalParameters": false, "generateJsonMethods": true, "enforceFlagEnums": false, "parameterArrayType": "System.Collections.Generic.IEnumerable", "parameterDictionaryType": "System.Collections.Generic.IDictionary", "responseArrayType": "System.Collections.Generic.ICollection", "responseDictionaryType": "System.Collections.Generic.IDictionary", "wrapResponses": false, "wrapResponseMethods": [], "generateResponseClasses": true, "responseClass": "SwaggerResponse", "namespace": "MyNamespace", "requiredPropertiesMustBeDefined": true, "dateType": "System.DateTime", "jsonConverters": null, "dateTimeType": "System.DateTime", "timeType": "System.TimeSpan", "timeSpanType": "System.TimeSpan", "arrayType": "System.Collections.ObjectModel.ObservableCollection", "arrayInstanceType": "System.Collections.ObjectModel.Collection", "dictionaryType": "System.Collections.Generic.Dictionary", "dictionaryInstanceType": "System.Collections.Generic.Dictionary", "arrayBaseType": "System.Collections.ObjectModel.Collection", "dictionaryBaseType": "System.Collections.Generic.Dictionary", "classStyle": "Inpc", "generateDefaultValues": true, "generateDataAnnotations": true, "excludedTypeNames": [], "excludedParameterNames": [], "handleReferences": false, "generateImmutableArrayProperties": false, "generateImmutableDictionaryProperties": false, "jsonSerializerSettingsTransformationMethod": null, "inlineNamedDictionaries": false, "inlineNamedTuples": true, "generateDtoTypes": true, "templateDirectory": null, "typeNameGeneratorType": null, "propertyNameGeneratorType": null, "enumNameGeneratorType": null, "serviceHost": null, "serviceSchemes": null, "output": null }, "swaggerToCSharpController": { "controllerBaseClass": null, "controllerStyle": "Partial", "controllerTarget": "AspNet", "useCancellationToken": false, "useActionResultType": false, "generateModelValidationAttributes": false, "routeNamingStrategy": "None", "className": "{controller}", "operationGenerationMode": "MultipleClientsFromOperationId", "additionalNamespaceUsages": [ "System.Web.Http" ], "additionalContractNamespaceUsages": [], "generateOptionalParameters": false, "generateJsonMethods": true, "enforceFlagEnums": false, "parameterArrayType": "System.Collections.Generic.IEnumerable", "parameterDictionaryType": "System.Collections.Generic.IDictionary", "responseArrayType": "System.Collections.Generic.ICollection", "responseDictionaryType": "System.Collections.Generic.IDictionary", "wrapResponses": false, "wrapResponseMethods": [], "generateResponseClasses": true, "responseClass": "SwaggerResponse", "namespace": "MyNamespace", "requiredPropertiesMustBeDefined": true, "dateType": "System.DateTime", "jsonConverters": null, "dateTimeType": "System.DateTime", "timeType": "System.TimeSpan", "timeSpanType": "System.TimeSpan", "arrayType": "System.Collections.Generic.IEnumerable", "arrayInstanceType": "System.Collections.ObjectModel.Collection", "dictionaryType": "System.Collections.Generic.Dictionary", "dictionaryInstanceType": "System.Collections.Generic.Dictionary", "arrayBaseType": "System.Collections.ObjectModel.Collection", "dictionaryBaseType": "System.Collections.Generic.Dictionary", "classStyle": "Inpc", "generateDefaultValues": true, "generateDataAnnotations": true, "excludedTypeNames": [], "excludedParameterNames": [], "handleReferences": false, "generateImmutableArrayProperties": false, "generateImmutableDictionaryProperties": false, "jsonSerializerSettingsTransformationMethod": null, "inlineNamedDictionaries": false, "inlineNamedTuples": true, "generateDtoTypes": true, "templateDirectory": null, "typeNameGeneratorType": null, "propertyNameGeneratorType": null, "enumNameGeneratorType": null, "serviceHost": null, "serviceSchemes": null, "output": null } } }

Hello.

I'm trying to update my angular-aspnetzero solution from angular 5 to angular 6. The solution is compiling successfully, but my services are not working anymore. The result return null, but i can see my api is working if i open the api url in a new tab. My servies is like this:

this._surveyStatisticsService.getCategoryChart(this.siteId, this.siteTypeId, this.cookieLangValue).subscribe((result) => { this.categoryList = result; }

Hi @ismcagdas I come over your interesting article Building a simple Angular Universal application with ASP.NET Boilerplate

I need to implement Angular Universal to speed up performance for first time visitors and to intergrate with social medias. My asp.net zero site has a public angular solution. So I wonder if you recommend to create a solution with .Net Core as you do in your article or a solution with Node Express Server?

Answer

Ok. Thanks :-)

Answer

So the best solution is to create a new MultiAnswerRepository class and a IMultiAnswerRepository interface and solve this dependency injection separatley?

Showing 1 to 10 of 98 entries