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