我的页面中有一个摩纳哥编辑器。现在,我需要不时隐藏/显示它。但我意识到它不能很好地使用ng-show
,ng-hide
或(见下面的截图) ng-if
。有没有人有办法解决吗?
https://jsbin.com/mepupagisi/4/edit?html,输出
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>
<div ng-show="true">
<div id="container"></div>
</div>
<script src="https://www.matrixlead.com/monaco-editor/min/vs/loader.js"></script>
<script>
require.config({ paths: { 'vs': 'https://www.matrixlead.com/monaco-editor/min/vs' }})
require(["vs/editor/editor.main"], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: 'function x() {\n\tconsole.log("Hello world!");\n}',
language: 'javascript',
minimap: { enabled: false },
scrollBeyondLastLine: false
});
});
</script>
</body>
</html>
编辑1:我仍然看到一条细线: