likeastore / ngDialog

Modals and popups provider for Angular.js applications
http://likeastore.github.io/ngDialog
3.14k stars 692 forks source link

Using ngDialog with components #517

Open sp90 opened 7 years ago

sp90 commented 7 years ago

Is it on the roadmap to get it working with components, so instead of parsing in controller and templateurl, just to parse component name?

fernahh commented 7 years ago

ping

bufface commented 7 years ago

Can somebody provide an example of this? I need help to try communicate NgDialog and a Component. Thanks!

fernahh commented 7 years ago

@bufface to solve my problem, I declared a value to scope property. Like this:

ngDialog.open({
  controllerAs: '$ctrl',
  scope: this.$scope,
  template: this.$templateCache.get('./modal.html')
})

it's not ideal, but resolves "palliatively"...

bufface commented 7 years ago

I'll try this @fernahh. It's a pity that does not support components. Maybe next release?

cseale commented 7 years ago

@sp90

You mean like this?


ngDialog.open({
  template: '<my-component></my-component>',
  plain: true
});
bufface commented 7 years ago

I couldn't try this, but I think it will works. Thanks @cseale

sp90 commented 7 years ago

@cseale is it possible to pass values down into the component with this?

sphinx117 commented 7 years ago

Hi Everybody is it possible to do something like

var anyJsobject = {}; var text = "i am the best text" ngDialog;.open({ template: '', plain: true });

I can't pass the anyObject .... Do you have a solution ??

sphinx117 commented 7 years ago

Ok after reading the doc we can do something like:

$newScope = $scope.$new(true); $newScope.data = {...}; $newScope.text = "Some text" ngDialog;.open({ template: ''<my-component data="data", text="text">, plain: true, scope: $newScope });