Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
joweste opened this issue Dec 11, 2017 · 0 comments
Open
2 tasks

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

joweste opened this issue Dec 11, 2017 · 0 comments

Comments

@joweste
Copy link

joweste commented Dec 11, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant