angular-xeditable
angular-xeditable copied to clipboard
compatibility with angular-material
https://github.com/angular/material -- it would be nice to use x-editable with this! currently, I can get the buttons, and probably the input, but there's just a lot to do.
However, it might want to wait until the select component is implemented over there.
:+1:
I'm not sure it is that hard. It seems to be possible by creating a new angular-material
theme.
@seiyria, this seems to work nicely, without any change to sources.
angular.module('myApp').run(function(editableOptions, editableThemes) {
editableThemes['angular-material'] = {
formTpl: '<form class="editable-wrap"></form>',
noformTpl: '<span class="editable-wrap"></span>',
controlsTpl: '<md-input-container class="editable-controls" ng-class="{\'md-input-invalid\': $error}"></md-input-container>',
inputTpl: '',
errorTpl: '<div ng-messages="{message: $error}"><div class="editable-error" ng-message="message">{{$error}}</div></div>',
buttonsTpl: '<span class="editable-buttons"></span>',
submitTpl: '<md-button type="submit" class="md-primary">save</md-button>',
cancelTpl: '<md-button type="button" class="md-warn" ng-click="$form.$cancel()">cancel</md-button>'
};
editableOptions.theme = 'angular-material';
});
with those styles:
md-input-container.editable-controls {
padding: 0;
}
md-input-container.editable-controls [ng-message] {
position: static;
}
@Toilal That worked ok, I had to make a few adjustments (submitTpl needed .md-primary, cancelTpl needed .md-warn) but other than that it was fine. It would still be nice to get this upstream though.
Problem is that there's no maintainer ... @vitalets @assisrafael Could you give some people access rights to maintain this repo ? There are many PRs pending ...
Another thing about this. Now that angular/material has updated, their templates have changed. The structure is a LOT different, and I wish a-xeditable was more flexible in this regard.
Basically, instead of giving it stuff like "inputTpl" I would rather just give it an entire template, structured however I want. It should be up to me to ensure the classes, etc get added correctly. In its current state, though, it's unusable AFAICT.
@seiyria @Toilal did you guys manage to get this working with angular material at the end? :)
Yes, with the snippet i've pasted, but I don't use it now. Don't know if it still works.
@Toilal its not working for me... if i manage to figure this out ill post it here :)
+1
This plugin is very great and used a lot in my previous project, thanks for your great work. I am trying material design now that the official angular material has come to 1.0 version but still no luck. @Toilal did you manage to solve the snippet? May i help in some way?
+1 It is nice.
@Toilal Thank you , your addition to angular
app.run
works great . I am using angular material 1.1.0 - and no bootstrap.css whatsoever
i added the following css tweaks:
md-input-container.editable-controls { padding: 1px ; padding-left: 10px ; margin: 1px ; } .editable-input.md-input { font-size: 18px ; font-weight: 600; color: #716e6e; max-width: 100px ; margin: 1px ; } .editable-wrap.editable-text { margin: 1px ; } md-input-container.editable-controls [ng-message] { position: static !important; }
@OscarAgreda : can u please advise exactly where did u add these style? Also is there any code things added as per @Toilal
can u give a working jsfiddle or plunker for this thanks guys
@OscarAgreda can you give an example running exeditable with angular material T_T
error : "md-input-container, can only have one input, textarea or md-select child element!" when using editable-radiolist.