проверить демо - http://jsfiddle.net/S8g4E/6/
использовать css -
#container { width: 300px; height: 300px; border:1px solid red; display: table;}
#up { background: green; display: table-row; }
#down { background:pink; display: table-row;}
Как и ответ на дубликат вопроса , который я изложил в комментариях. Вы можете использовать это для удовлетворения своих потребностей. Например:
HTML
<div id="YourElementId" ng-app='MyModule' ng-controller="MyController">
Hi
</div>
JS-код
angular.module('MyModule', [])
.controller('MyController', function ($scope) {
$scope.myfunction = function (data) {
alert("---" + data);
// Do something more...
};
});
// I changed the code here so when element with ID "YourElementId"
// gets clicked, it executes the anonymous function that calls "myFunction"
// in the controller "MyController"
window.onload = function () {
angular.element(document.getElementById('YourElementId')).on('click', function (event) {
angular.element(event.target).scope().myfunction('test');
});
}