Hello,
I would like to combine two functions, but I have difficulties with it.
I have the two functions:
<script>
function myFunction(x) {
if (x.matches) { // If media query matches
window.location.replace("http://somewhere.com");
}else{
window.location.replace("http://somewhere.com")
}
}
var x = window.matchMedia("(max-width: 700px)")
myFunction(x) // Call listener function at run time
x.addListener(myFunction) // Attach listener function on state changes
</script>
and:
<script>
var value = "Hello World";
// or overwrite value in your callback function ...
this.scope.action = function() { return value; }
</script>
<md-button ng-click="send({payload:action()})">
Click me to send a hello world
</md-button>
So how I can send Hello World from my dashboard template when the size of the screen change??
If I add send({payload:action()})
to my if query, it doestn work. I just dont get how to send any msg, when something happens. The example with button is good, but its html, ho to do this with javascript inside dashboard template node?