タイトルの通りです。このコードは coffee scriptでどう記述されるのでしょうか。
よろしくお願いいたします。
lang
1var app = angular.module('sampleApp', []); 2 3function MyController($scope) { 4 5 $scope.foo = "" 6 $scope.lastSubmitted = "" 7 8 $scope.submit = function() { 9 $scope.lastSubmitted = $scope.foo; 10 } 11} 12 13app.directive('enterSubmit', function () { 14 return { 15 restrict: 'A', 16 link: function (scope, elem, attrs) { 17 18 elem.bind('keydown', function(event) { 19 var code = event.keyCode || event.which; 20 21 if (code === 13) { 22 if (!event.shiftKey) { 23 event.preventDefault(); 24 scope.$apply(attrs.enterSubmit); 25 } 26 } 27 }); 28 } 29 } 30});
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/06/19 13:33