Comments (10)
Hi!
I don't see how the dialog could be made in a service. There is alert
and confirm
boxes already in a service (http://ui.lumapps.com/services/notifications), and for complex dialog, there is the directive.
For the progress, I think it might be interesting, but for now you can add it to a dive by specifying it. It's not well documented, but we're working on that. Here's how to do it:
LxProgressService.linear.show('#E95F47', '.selector');
The selector add the progress to the specific div corresponding to this selector.
But yeah, a directive would be nice. And especially the ability to have multiple progress. We'll see that when discussing our roadmap for the end of the week.
from lumx.
I've just wrapped the Dialog directive into a service, so I can use it like this:
izDialog.show({
templateUrl: 'izLoginDialog.html',
controller: 'izLoginDialogCtrl'
});
This is the code for izDialog service:
'use strict';
angular.module('IzzuiApp').service('izDialog', function ($q, $compile, $controller, $templateCache, $http, $rootScope, LxDialogService) {
this.show = function (options) {
var template = $templateCache.get(options.templateUrl),
dialogPromise = $q.defer(),
templatePromise;
if (template)
{
templatePromise = $q.when(template);
}
else {
templatePromise = $http.get(options.templateUrl).then(function (response) {
$templateCache.put(options.templateUrl, response.data);
return response.data;
});
}
templatePromise.then(function (template) {
var element = angular.element(template),
scope = $rootScope.$new();
scope.element = element;
scope.parent = element.parent();
$controller(options.controller, { $scope: scope, dialogPromise: dialogPromise });
$compile(element)(scope);
LxDialogService.registerScope(options.templateUrl, scope);
LxDialogService.open(options.templateUrl);
dialogPromise.promise.finally(function () {
LxDialogService.close(options.templateUrl);
});
});
return dialogPromise.promise;
};
});
from lumx.
Good solution. There is a downside though. It's harder to send data to the dialog controller with your solution. The current solution implemented in LumX make the dialog and the caller share the same controller, so it's easy. But your solution should be available too I think. We'll talk about it during our roadmap meeting.
Thanks for the solution!
from lumx.
Sure, my solution was in fact a quick wrapper inspired by the $mdDialog service, but it's not complete in any way. There should be an "locals" option. Take a look here to see all the options that should be in the service:
https://material.angularjs.org/#/api/material.components.dialog/service/$mdDialog
from lumx.
Just to make it clear that there are a lot of design choices in lumx that are way better than the angular-material project (that's in fact why we decided to switch). I'm just pointing out a couple of points which I thought they came up with a better solution.
from lumx.
We did not take it badly ;). Like I said, it's a good point. The roadmap will be written tomorrow, and making more service/providers in addition to directives will definitely be on the discussion.
from lumx.
Any news on the roadmap? If you would like us to pitch in with some features, we would love to.
We already built our own wrappers around dialog and progress components. We would have no problem in integrating our code into Lumx if it fits the roadmap.
from lumx.
Hi, we would be very interested if you can contribute to LumX with your wrappers? Thank you!
from lumx.
1+
It would be really good if someone could write a more advanced Dialog Service for lumX.
Thank you.
from lumx.
Needed to replace
scope.element = element;
scope.parent = element.parent();
with
scope.lxDialogIsOpened = false;
scope.lxDialogElement = element;
scope.lxDialogParent = element.parent();
to get @demetriusnunes example to work. If I could figure out how to use controller as syntax with that option while defining the izDialog.show controller option in closure I would be a happy camper :)
from lumx.
Related Issues (20)
- How to get left and right sidebar?
- Tooltip on disable element
- wrong "UPDATE SELECTION" button color HOT 1
- IE 10 select not opening when clicking on label HOT 2
- Framework Documentation Error HOT 2
- Can I use Angular with Lumx? HOT 1
- Programmatically close LxNotificationService.alert
- LxNotificationService does not escape html/js code. HOT 2
- Dropdown broken on mobile devices HOT 1
- can i use this framework in AngularJs 6?? HOT 1
- LxNotificationService prevent duplicates
- Date Picker without november 2020 days HOT 3
- Up to date doc
- _canceled always true when closing a dialog HOT 1
- Template error after compile HOT 1
- Track by error in lumX select when multiple elements have the same value HOT 1
- selecting the file when we want clear that field allow clear is not working
- Opening dropdown menu causes page scroll to top
- LxNotificationService can we change the position
- lx-select with filter closes automaticly on touch on mobile device
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lumx.