我有一个简单的页面,我正在尝试使用 JQuery Layout 插件。代码是:
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Layout Example</title>
</head>
<body>
<div class="ui-layout-center">
Angular test:
<input type="text" ng-model="name" />{{name}}
</div>
<div class="ui-layout-north">North</div>
<div class="ui-layout-south">South</div>
<div class="ui-layout-east">East</div>
<div class="ui-layout-west">West</div>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://code.angularjs.org/1.2.13/angular.js"></script>
<script src="http://layout.jquery-dev.net/lib/js/jquery.layout-latest.js"></script>
<script type="text/javascript">
var app = angular.module('app', []);
app.directive('body', function() {
return {
restrict: 'E',
link: function(scope, elm, attrs) {
console.log("applying layout");
elm.layout({
applyDefaultStyles: true
});
}
};
});
</script>
</body>
</html>
现在,当我尝试包装 ui-layout-container 时,屏幕上什么也没有出现。但是,我可以在 Web 开发人员工具栏中看到布局的完整代码。代码是:
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Layout Example</title>
</head>
<body>
<div class="wrapper">
<div class="ui-layout-center">
Angular test:
<input type="text" ng-model="name" />{{name}}
</div>
<div class="ui-layout-north">North</div>
<div class="ui-layout-south">South</div>
<div class="ui-layout-east">East</div>
<div class="ui-layout-west">West</div>
</div>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://code.angularjs.org/1.2.13/angular.js"></script>
<script src="http://layout.jquery-dev.net/lib/js/jquery.layout-latest.js"></script>
<script type="text/javascript">
var app = angular.module('app', []);
app.directive('wrapper', function() {
return {
restrict: 'C',
link: function(scope, elm, attrs) {
console.log("applying layout");
elm.layout({
applyDefaultStyles: true
});
}
};
});
</script>
</body>
</html>
所以,看起来我无法正确传递类名。应该将什么作为类名传递以使其工作?谢谢
编辑:您可以在 Plunker 中复制并粘贴代码以查看问题。