Skip to content

Toaster [$sce:itype] issue again in 2.3.0 version #85

Description

@joweste

Version

2.3.0

Directive

  • [x ] stepway
  • formViewer
  • dragdropway

Steps to reproduce

  1. Execute the demo : "Easy for generator step way version"
  2. Fill data in design editor
  3. try to save
    The toast message appears on screen correctly but I get the next error in console:
    Error: [$sce:itype] Attempted to trust a non-string value in a content requiring a string: Context: html

I have add bodyOutputType: 'trustedHtml' at function saveThisForm() but without success.

I debugged eda.stepway.js code and It seems something is calling this code from Toast component
two times:
//from toaster.js

if (toast.showCloseButton) {
     toast.closeHtml = $sce.trustAsHtml(toast.closeHtml || scope.config.closeHtml);
}

So, toast.closeHtml is being trusted two times. The second time issues the error.

If I put showCloseButton: false into saveThisForm() no problem appears.

//saveThisForm() from eda.stepway.js

value: function saveThisForm() {
	      if (typeof this.configuration.formName === 'undefined') {
	        this.toaster.pop({
	          type: 'warning',
	          timeout: 2000,
	          title: 'Form name is undefined',
	          body: 'Form has not been saved.',
	          showCloseButton: true
	        });
	        return false;
	      }
	
	      if (this.configuration.formName === '') {
	        this.toaster.pop({
	          type: 'warning',
	          timeout: 2000,
	          title: 'Form name is required',
	          body: 'Form has not been saved.',
	          showCloseButton: true
	        });
	        return false;
	      }
	
	      this.toaster.pop({
	        type: 'wait',
	        timeout: 3000,
	        title: ': Form is being saved',
	        body: '',
               bodyOutputType: 'trustedHtml',   ///I add it but no results 
	        showCloseButton: true
	      });
	      // this.toaster.clear();
	      this.returnSaveEvent = true;
	
	      return true;
	    }

Expected behavior

The error stops to appears

Actual behavior

I get the next error:

angular.js:14328 Error: [$sce:itype] Attempted to trust a non-string value in a content requiring a string: Context: html
http://errors.angularjs.org/1.6.1/$sce/itype?p0=html
    at http://localhost/lib/angular/angular.js:68:12
    at trustAs (http://localhost/lib/angular/angular.js:18787:15)
    at Object.sce.(anonymous function) [as trustAsHtml] (http://localhost/lib/angular/angular.js:19543:16)
    at addToast (http://localhost/lib/angular-toaster/toaster.js:362:56)
    at Array.scope._onNewToast (http://localhost/lib/angular-toaster/toaster.js:451:33)
    at http://localhost/lib/angular-toaster/toaster.js:165:68
    at Scope.$emit (http://localhost/lib/angular/angular.js:18225:33)
    at Object.pop (http://localhost/lib/angular-toaster/toaster.js:113:32)
    at edaStepWayEasyFormGenController.saveThisForm (http://localhost/lib/easyFormGenerator/dist/eda.stepway.js:5891:21)
    at fn (eval at compile (http://localhost/lib/angular/angular.js:15156:15), <anonymous>:4:168)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions