Problem dotyczy biblioteki Angular od Google'a. Chciałbym zrobić coś prostego. Mianowicie przycisk, który znika/pojawia się za pomocą dyrektywy ng-show. Jednak nic nie dzieje się na ekranie, nawet jeżeli ręcznie wpiszę wartość (tj. ng-show="false"). Przekopuje od wczoraj forum za forum i nic mi nie działa, a problem jest zapewne prosty
index.html:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl" ng-app='Textarea'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Angular - Textarea</title>
<link rel='stylesheet' type='text/css' href='style.css' />
<script type='text/javascript'
src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script type='text/javascript'
src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js'></script>
<script type='text/javascript' src='ng-controllers.js'></script>
</head>
<body style='padding:0px; margin:0px;' onload=''>
<div class='Cont' ng-controller='TextAreaCtrl as ctrl'>
<div class='TextAreaCont'>
<textarea ng-model='text' placeholder='Write something...'></textarea>
</div>
<div class='ButtonCont' ng-show='ctrl.isButtonVisible()'>
<button ng-click='ctrl.send()'>Send</button>
</div>
</div>
</body>
</html>
kontroler:
angular.module('Textarea', [])
.controller('TextAreaCtrl',['$scope', function($scope){
$scope.isButtonVisible = function(){
return false;
}
$scope.send = function(){
}
}]);