<div id="outer" style="min-width: 2000px; min-height: 1000px; background: #3e3e3e;">
<div id="inner" style="left: 1%; top: 45px; width: 50%; height: auto; position: absolute; z-index: 1;">
<div style="background: #efffef; position: absolute; height: 400px; right: 0px; left: 0px;"></div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
我想要发生的是内部div占用给予其父div(外部)50%的空间.相反,它正在获得视口可用空间的50%,这意味着随着浏览器/视口的大小缩小,它也会缩小.
鉴于外div有min-width的2000px,我希望内部的div至少1000px宽.
我试图从我的链接功能中查看我的模型值.
scope.$watch(attrs.ngModel, function() {
console.log("Changed");
});
Run Code Online (Sandbox Code Playgroud)
当我更改控制器内的模型值时,不会触发$ watch函数.
$scope.myModel = "ACT";
$timeout(function() {
$scope.myModel = "TOTALS";
}, 2000);
Run Code Online (Sandbox Code Playgroud)
小提琴:http://jsfiddle.net/dkrotts/BtrZH/4/
我在这里错过了什么?
我很难理解ng-options如何与数据源一起工作.我已经阅读了文档,我觉得我正在完成所需的工作,但在尝试时仍然会遇到问题.
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"> </script>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript">
angular.module('app', [])
.controller('IndexCtrl', ['$scope', function($scope) {
$scope.types = {
1: "value1",
2: "value2",
5: "value3"
};
}]);
</script>
</head>
<body ng-controller="IndexCtrl">
<select ng-model="type" ng-options="k as v for(k, v) in types">
<option value="">Select Type</option>
</select>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我总是在控制台中收到此错误:
错误:
预期的ngOptions形式为' select(as label)?for(key,)?值的集合(由轨道EXPR)?" 但是在类型中得到'k为(k,v)的v'.
我做错了什么?
请参见plunkr:
我NVD3在同一个svg中有几个不同的图表.我使用按钮来调用函数,每个函数都包含一个使用自己数据的新图表.
有没有办法清除我的单个svg而不删除它?我想按一个按钮来调用我的图表,但在加载新图表之前清除svg.
使用这种图表时不是问题... multibarhorizontal例如,调用两个图表只是更新形状,这很好.问题是加载两个不同的图表,如线条和条形图.
提前致谢
编辑 - 答案必须是类似d 3.select("svg").remove()但只删除svg.我只想清除它.
我有价格的数组(0,0.99,1.99...等),我想显示<select>.
我想用角的ng-options这样
<select ng-model="create_price" ng-options="obj for obj in prices"/>
Run Code Online (Sandbox Code Playgroud)
由于这是显示它上面会产生一个选择0,0.99,1.99...
但我想在代码中使用过滤器使得每个字时的价格"呈现(或者类似的东西),代码将运行一个函数来改变浮点数为字符串和现在(free,0.99$,1.99$...等).
我有办法做到这一点吗?
谢谢
是否可以将外部图像URL用于CSS自定义游标?以下示例不起作用:
HTML:
<div class="test">TEST</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.test {
background:gray;
width:200px;
height:200px;
cursor:url('http://upload.wikimedia.org/wikipedia/commons/d/de/POL_apple.jpg');
}
Run Code Online (Sandbox Code Playgroud)
我试图在我的网站中使用Select2库来利用placecomplete(遵循这里相当简单的配置步骤),但是当我运行代码时,我得到一个奇怪的错误 -
错误:没有select2/compat/query`
我试过谷歌搜索它,似乎没有其他人遇到过这个?
我的代码简而言之,是
加载文件...
<link href="scripts/Select2/dist/css/select2.min.css" rel="stylesheet" />
<script src="scripts/Select2/dist/js/select2.min.js"></script>
<script src="scripts/jquery.placecomplete.js">//<![CDATA[//]]></script>
Run Code Online (Sandbox Code Playgroud)
标记我体内的输入元素......
<input id="example123" class="example123" type="text" />
Run Code Online (Sandbox Code Playgroud)
在我的document.ready函数中,调用以下代码...
$('#example123').placecomplete({});
Run Code Online (Sandbox Code Playgroud)
这就是它抛出错误的地方.
我出错的任何想法,这个错误意味着什么?
我不明白types字段的含义tsconfig.json.在文档中我读过这样的文字:
"types": {
"description": "Type declaration files to be included in compilation. Requires TypeScript version 2.0 or later.",
"type": "array",
"items": {
"type": "string"
}
},
Run Code Online (Sandbox Code Playgroud)
到目前为止,据我所知,如果我安装,@types/express我应该添加这样的字符串tsconfig.json
{
"compilerOptions": {
...
"types": ["lodash"]
}
}
Run Code Online (Sandbox Code Playgroud)
但没有它,一切都很好.现在我不明白,为什么我需要types田地
我正在使用角度UI-Router.我的路由配置中有以下内容
.config(function config($stateProvider) {
$stateProvider.state('newsFeedView', {
url: '/newsFeed',
controller: 'newsFeedController',
templateUrl: '../src/app/bulletinBoard/views/newsFeed.part.html',
data: {
pageTitle: 'News Feed'
}
})
.state('tradeFeedView', {
url: '/tradeFeed',
controller: 'tradeFeedController',
templateUrl: '../src/app/bulletinBoard/views/tradeFeed.part.html',
data: {
pageTitle: 'Trade Feed'
}
})
.state('bulletinBoard', {
url: '/bulletinBoard',
views: {
'tradeFeed': {
url: "",
controller: 'tradeFeedController',
templateUrl: '../src/app/bulletinBoard/views/tradeFeed.part.html'
},
'newsFeed': {
url: "",
controller: 'newsFeedController',
templateUrl: '../src/app/bulletinBoard/views/newsFeed.part.html'
}
},
templateUrl: '../src/app/bulletinBoard/views/bulletinBoard.part.html'
});
})
Run Code Online (Sandbox Code Playgroud)
在我的索引页面中,我只使用以下方法调用视图:
<div class="container" ui-view></div>
Run Code Online (Sandbox Code Playgroud)
在我的bulletinBoard.html中,我希望有一个嵌套视图:
<div ui-view="tradeFeed"></div>
<div ui-view="newsFeed"></div>
Run Code Online (Sandbox Code Playgroud)
对于/ newsFeed页面和/ tradeFeed页面,这非常有效,但对于公告板,我无法在页面上看到任何内容.我哪里错了?
如何使按钮成为链接并在bootstrap 3中弹出一个?
码
<a href="" data-toggle="modal" data-target=".bannerformmodal">Load me</a>
<div class="modal fade bannerformmodal" tabindex="-1" role="dialog" aria-labelledby="bannerformmodal" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Contact Form</h4>
</div>
<div class="modal-body">
<form id="requestacallform" method="POST" name="requestacallform">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input id="first_name" type="text" class="form-control" placeholder="First Name" name="first_name"/>
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input id="last_name" type="text" class="form-control" placeholder="Last Name" name="last_name"/>
</div>
</div>
<div class="form-group">
<div class="input-group">
<span …Run Code Online (Sandbox Code Playgroud) angularjs ×4
css ×2
html ×2
javascript ×2
jquery ×2
ng-options ×2
charts ×1
css-position ×1
cursor ×1
d3.js ×1
filter ×1
nvd3.js ×1
typescript ×1
width ×1