Base solution for your next web application

Activities of "michaelhilgers"

Answer

Hi,

I got the same problem.

Do you have a solution for it ?

Thanks !

Hi,

I have a little problem. I uploaded a file (excel) in the clientsite (Angular 2).

But If I try to send it to the server I get an 500 error.

I modified the code in the service-proxies.ts like this:

createOrUpdatePostListe(file: any): Observable<void> {
        let url_ = this.baseUrl + "/api/services/app/Post/CreateOrUpdatePostListe";

        let fileTest: File = file.target.files[0];
        let formData: FormData = new FormData();
        formData.append('uploadFile', fileTest, fileTest.name);

        //const content_ = JSON.stringify(formData);
        const content_ = formData;
        
        return this.http.request(url_, {
            body: content_,
            method: "post",
            headers: new Headers({
                "Content-Type": "multipart/form-data", 
                "Accept": "application/json; charset=UTF-8"
            })
        }).map((response) => {
            return this.processCreateOrUpdatePostListe(response);
        }).catch((response: any, caught: any) => {
            if (response instanceof Response) {
                try {
                    return Observable.of(this.processCreateOrUpdatePostListe(response));
                } catch (e) {
                    return <Observable<void>><any>Observable.throw(e);
                }
            } else
                return <Observable<void>><any>Observable.throw(response);
        });
    }

I changed the Content-Type from "application/json" to "multipart/form-data".

If I use the "JSON.stringify(formData)" to set the content, my function on Server was called but the parameter with the excel sheet was empty.

How can I get my excel sheet on serversite ?

Thanks !

Hi,

My tsconfig.json looks like this :

{
  "compileOnSave": false,
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc-e2e",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ]
  }
}

But event if I replace my config with the suggested config it doesn't work.

Hi,

I have a lot of error messages in Visual Studio. All errors come from TypeScript Virtual Projects.

I would like using my project on a new installed pc. Visual Studio 2015 Update 3

I installed globaly: node v6.9.5 , npm 5.0.3 angular-cli:1.0.0-rc.0 For the project there is Node : v6.9.5, npm : 3.10.10, TypeScript : 2.0.8 angular cli : 1.0.0-rc.0 installed

package.json :

{
  "name": "abp-zero-template",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0 --port 4200 --live-reload-port 4201",
    "hmr": "ng serve --host 0.0.0.0 --port 4200 --live-reload-port 4201 --hmr -e=hmr",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/cli": "1.0.0-rc.0",
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "@types/bootstrap": "^3.3.32",
    "@types/bootstrap-datepicker": "0.0.6",
    "@types/jquery": "^2.0.33",
    "@types/jquery.blockui": "0.0.27",
    "@types/jstree": "^3.3.32",
    "@types/lodash": "^4.14.37",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.2.32",
    "@types/node": "^6.0.42",
    "@types/select2": "^4.0.34",
    "@types/signalr": "^2.2.32",
    "@types/toastr": "^2.1.32",
    "abp-ng2-module": "^0.2.1",
    "abp-web-resources": "^1.3.0",
    "block-ui": "^2.70.1",
    "bootstrap": "^3.3.7",
    "bootstrap-colorpicker": "^2.5.1",
    "bootstrap-datepicker": "^1.6.4",
    "bootstrap-daterangepicker": "^2.1.24",
    "bootstrap-select": "^1.11.2",
    "bootstrap-switch": "^3.3.2",
    "core-js": "^2.4.1",
    "famfamfam-flags": "^1.0.0",
    "font-awesome": "^4.6.3",
    "jquery": "3.1.1",
    "jquery-migrate": "^3.0.0",
    "jquery-slimscroll": "^1.3.8",
    "jquery-sparkline": "^2.4.0",
    "jquery.uniform": "^4.0.1",
    "jqueryui": "^1.11.1",
    "js-cookie": "^2.1.3",
    "jstree": "^3.3.2",
    "jtable": "^2.4.1",
    "localforage": "^1.4.3",
    "lodash": "^4.16.4",
    "moment": "^2.15.1",
    "moment-timezone": "^0.5.7",
    "morris.js": "^0.5.0",
    "ng2-bootstrap": "^1.1.16-11",
    "ng2-file-upload": "^1.1.4-2",
    "ng2-recaptcha": "^1.4.0",
    "raphael": "^2.2.7",
    "rtl-detect": "^1.0.0",
    "rxjs": "^5.0.1",
    "select2": "^4.0.3",
    "select2-bootstrap-theme": "^0.1.0-beta.10",
    "signalr": "^2.2.1",
    "simple-line-icons": "^2.4.1",
    "spin.js": "^2.3.2",
    "sweetalert": "^1.1.3",
    "timeago": "^1.5.3",
    "toastr": "^2.1.2",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.4",
    "timepicker": "^1.11.9",
    "ng2-cache": "^0.1.11"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.0",
    "@angular/compiler-cli": "^2.3.1",
    "@angularclass/hmr": "^1.2.2",
    "@types/grecaptcha": "^2.0.30",
    "@types/jasmine": "^2.2.30",
    "@types/morris.js": "^0.5.5",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.4",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.3.2",
    "nswag": "^8.1.0",
    "protractor": "4.0.14",
    "ts-node": "1.7.2",
    "tslint": "^4.3.0",
    "typescript": "2.0.8"
  }
}

For some errors please see the picture...

Do you have an idea where the error comes from ?

Thanks !

Hi

i have the same problem, <a class="postlink" href="https://pm.ligna-systems.com/account/login">https://pm.ligna-systems.com/account/login</a>

have you any idea how i can fix it?

Thanks

Angular 2, Asp Core, Abp 1.5.0

Hi,

I try a lot of things to prevent the back button in the browser and on a mobile phone. If I'm on a modal i'd like to prevent the back button behavior

I try using jQuery like

$(document).on('keydown', function (event) {
            if (event.keyCode == 27) {
                // Prevent default (disable the back button behavior)
                event.preventDefault();

                // Close the modal
                self.close();
}

And then I use

window.addEventListener('onpopstate',
            // Add your callback here
            (event) => event.preventDefault()
        );

But it doesn't work... the page go always to the previous page.

How can I prevent this behavior if I'm on a modal

Thanks !!

Answer

Hi,

I found a solution for client site caching if someone look for it :

<a class="postlink" href="https://github.com/Jackson88/ng2-cache">https://github.com/Jackson88/ng2-cache</a>

Hi,

I'm using Abp 1.5.0 with angular2 and Asp.net core. My appconfig.json looks like: { "remoteServiceBaseUrl": "https://pm-host.mydomain.com", "appBaseUrl": "https://pm-{TENANCY_NAME}.mydomain.com" }

My appsettings.json looks like :

"App":{ "WebSiteRootAddress": "https://pm-{TENANCY_NAME}.mydomain.com/", "CorsOrigins": "https://pm-tenant1.mydomain.com,https://pm-tenant2.mydomain.com }

I changed the AppPreBootstrap function to avoid the <a class="postlink" href="https://pm-null.mydomain.com">https://pm-null.mydomain.com</a> as follow

let subdomainTenancyNameFinder = new SubdomainTenancyNameFinder();
            console.log('1. appBaseUrl : ' + result.appBaseUrl);
            var tenancyName = subdomainTenancyNameFinder.getCurrentTenancyNameOrNull(result.appBaseUrl);
            console.log('2. tenancyName : ' + tenancyName);
            AppConsts.remoteServiceBaseUrl = result.remoteServiceBaseUrl.replace(AppConsts.tenancyNamePlaceHolderInUrl, tenancyName);

            AppConsts.appBaseUrlFormat = result.appBaseUrl;
            AppConsts.remoteServiceBaseUrlFormat = result.remoteServiceBaseUrl;

            if (tenancyName == null) {
                AppConsts.appBaseUrl = result.appBaseUrl.replace('-' + AppConsts.tenancyNamePlaceHolderInUrl, "");
            } else {
                AppConsts.appBaseUrl = result.appBaseUrl.replace(AppConsts.tenancyNamePlaceHolderInUrl, tenancyName);
            }

To show the tenancy name I wrote the consol.log in the preBootstrap function and I could see that the tenancy name was correct but the application didn't change the tenant.

I'm always logged in as host tenant.

Any suggestions ?

Answer

Hi,

I created a modal 'workModal' that contains list of details => "workDetails". In the workModal I have a foreach loop for the workDetails and inside the foreach loop I have a component to show the informations

// inside the 'workModal'
 <div class="panel panel-default" *ngFor="let arbeitszeitDetail of workDetails; let index = index;let first = first;let last = last;">
          <createUpdateWorkDetail [userId]="currentUser.id" [arbeitszeitDetail]="arbeitszeitDetail"  
(arbeitszeitDetailDelete)="deleteArbeitszeitDetail($event);" 
                                   (arbeitszeitDetailChanged)="validateUserInput($event, index);" [index]="index" [first]="first" [last]="last"></createUpdateWorkDetail>
</div>

In the <createUpdateWorkDetail > Component, are other custom components and these components call the server to get datas from the db and these datas I would like caching for some minutes.

Is it possible ?

Question

Angular 2, Asp.core ( .Net4.6)

Hi,

How can I enable client site caching in my project ?

Thanks

Showing 1 to 10 of 41 entries