JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp">
<div ng-controller="mainController as main" style="height: 100vh; min-height: 100vh;" ng-cloak>
<textarea ng-model="main.queryString"
style="resize: vertical;font-size:16px; border: 1px solid #CCC; outline: none; box-shadow: 0 0 5px #7FD292; height:40px;padding:7px 8px 0px 8px;" rows="1"
ng-keydown="main.textareaAction($event)"
not-on-mobile="auto-focus"></textarea>
</div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.controller('mainController', function($scope) {
this.textareaAction = function(e) {
console.log("teste1");
};
});
myApp.directive('notOnMobile', function($compile) {
// Perform detection.
// This code will only run once for the entire application (if directive is present at least once).
// Can be moved into the compile function if detection result needs to be passed as attribute.
var onMobile = false;
return {
compile: function compile(tElement, tAttrs) {
if (!onMobile) tElement.attr(tAttrs.notOnMobile, '');
tElement.removeAttr('not-on-mobile');
return function postLink(scope, element) {
$compile(element)(scope);
};
}
};
});