Problema repitar inputs de MDL solucionado con $watch
This commit is contained in:
parent
1bcf91f58f
commit
d5507e472a
|
@ -2,6 +2,6 @@ vn-app {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
vn-app .main-view > * {
|
||||
.main-view > * {
|
||||
height: 100%;
|
||||
}
|
|
@ -8,7 +8,7 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive(resolve) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
template: function(_, attr) {
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,15 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch (attrs.model, () => {
|
||||
element[0].firstChild.MaterialCheckbox.updateClasses_();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,11 +9,16 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
template: function(_, attrs) {
|
||||
normalizer.normalize (attrs);
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.model, () => {
|
||||
element[0].firstChild.MaterialTextfield.updateClasses_();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,10 +9,15 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
normalizer.normalize (attrs);
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.model, () => {
|
||||
element[0].firstChild.MaterialTextfield.updateClasses_();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive(resolve) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
template: function(_, attr) {
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject =[resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
return{
|
||||
require:'E',
|
||||
restrict:'E',
|
||||
template: function(_,attr){
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
}
|
||||
|
|
|
@ -18,9 +18,4 @@
|
|||
|
||||
.mdl-button--raised:hover {
|
||||
background-color: #ffa410;
|
||||
}
|
||||
|
||||
.mdl-textfield__label{
|
||||
top: 0px;
|
||||
font-size: 12px;
|
||||
}
|
|
@ -6,15 +6,19 @@ import * as util from '../util';
|
|||
const _NAME = 'password';
|
||||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject =[resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive (resolve, normalizer){
|
||||
return{
|
||||
require:'E',
|
||||
template: function(_, attrs){
|
||||
normalizer.normalize (attrs);
|
||||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.model, () => {
|
||||
element[0].firstChild.MaterialTextfield.updateClasses_();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_module.directive(NAME,directive);
|
||||
|
|
|
@ -11,7 +11,7 @@ export function directive(resolver) {
|
|||
template: function(_, attrs) {
|
||||
return resolver.getTemplate(_NAME, attrs);
|
||||
},
|
||||
controller: function () {
|
||||
controller: function() {
|
||||
this.onClick = function (event) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@ import * as util from '../util';
|
|||
const _NAME = 'radio';
|
||||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject =[resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive(resolve) {
|
||||
return{
|
||||
require:'E',
|
||||
template: function(_,attr){
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_module.directive(NAME,directive);
|
||||
_module.directive(NAME, directive);
|
||||
|
|
|
@ -5,14 +5,14 @@ import * as util from '../util';
|
|||
const _NAME = 'snackbar';
|
||||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject =[resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive(resolve) {
|
||||
return{
|
||||
require:'E',
|
||||
template: function(_,attr){
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_module.directive(NAME,directive);
|
||||
_module.directive(NAME, directive);
|
||||
|
|
|
@ -6,10 +6,10 @@ const _NAME = 'spinner';
|
|||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
export function directive(resolve) {
|
||||
return{
|
||||
restrict: 'E',
|
||||
template: function(_, attrs){
|
||||
template: function(_, attrs) {
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject =[resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
return{
|
||||
require:'E',
|
||||
restrict:'E',
|
||||
template: function(_,attr){
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,16 @@ export const NAME = util.getName(_NAME);
|
|||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
require: 'E',
|
||||
restrict: 'E',
|
||||
template: function(_, attrs) {
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.model, () => {
|
||||
element[0].firstChild.MaterialTextfield.updateClasses_();
|
||||
});
|
||||
scope.$on ('$destroy', () => console.log ('Destroyed!'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,10 +10,7 @@ export const COMPONENT = {
|
|||
},
|
||||
controller: function($http) {
|
||||
$http.get('/client/api/SalesPeople').then(
|
||||
json => {
|
||||
this.sales = json.data;
|
||||
console.log(this.sales);
|
||||
},
|
||||
json => this.sales = json.data,
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
this.submit = function() {
|
||||
|
|
|
@ -9,13 +9,6 @@ export const COMPONENT = {
|
|||
client: '<'
|
||||
},
|
||||
controller: function($http) {
|
||||
$http.get('/client/api/SalesPeople').then(
|
||||
json => {
|
||||
this.sales = json.data;
|
||||
console.log(this.sales);
|
||||
},
|
||||
json => console.error(json.data.error.message)
|
||||
);
|
||||
this.submit = function() {
|
||||
$http.put('/client/api/Clients', this.client).then(
|
||||
json => console.log(json.statusText),
|
||||
|
|
|
@ -21,12 +21,10 @@ export const COMPONENT =
|
|||
else
|
||||
showMessage('Please insert your email and password');
|
||||
};
|
||||
|
||||
function onLoginOk (response) {
|
||||
setLoading(false);
|
||||
window.location = response.data.location +'?access_token='+ response.data.accessToken;
|
||||
}
|
||||
|
||||
function onLoginErr(response) {
|
||||
setLoading(false);
|
||||
self.model.password = '';
|
||||
|
@ -46,11 +44,9 @@ export const COMPONENT =
|
|||
|
||||
showMessage(message);
|
||||
}
|
||||
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function setLoading(isLoading) {
|
||||
// FIXME: Al minimificar MaterialSpinner es undefined
|
||||
/* var spinner = $('spinner').firstChild.MaterialSpinner;
|
||||
|
@ -60,7 +56,6 @@ export const COMPONENT =
|
|||
else
|
||||
spinner.stop();
|
||||
*/ }
|
||||
|
||||
function showMessage(message) {
|
||||
// FIXME: Al minimificar no muestra la barra
|
||||
var snackbar = $('snackbar').firstChild.MaterialSnackbar;
|
||||
|
|
Loading…
Reference in New Issue