- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如标题所示,我想动态更改我的 ui-gmap-google-map
元素上的圆的半径,我尝试在文本框上使用 onChange 函数来请求像这样的半径:
HTML
<label for="distance" style="white-space: nowrap;">Enter a radius</label>
<input type="text" required class="form-control" placeholder="Kilometers" ng-change="setRadius()" name="distance" ng-model="map.marker.circle.radius" />
在我的 Controller 中
$scope.setRadius = function() {
$scope.circles.radius = $scope.map.marker.circle.radius * 1000;
}
我也试过在“circles”数组中直接更改它,但还是没有结果。
圆形数组
$scope.circles = [
{
id: 1,
center: {
latitude: $scope.map.center.latitude,
longitude: $scope.map.center.longitude
},
radius: $scope.circleRadius,
stroke: {
color: '#08B21F',
weight: 2,
opacity: 1
},
fill: {
color: '#08B21F',
opacity: 0.5
},
geodesic: true, // optional: defaults to false
draggable: false, // optional: defaults to false
clickable: false, // optional: defaults to true
editable: false, // optional: defaults to false
visible: true, // optional: defaults to true
control: {}
}
];
改变半径的函数
$scope.setRadius = function() {
$scope.circleRadius = $scope.map.marker.circle.radius * 1000;
}
map 的 HTML
<ui-gmap-google-map center="map.center" zoom="map.zoom">
<ui-gmap-window show="map.window.show" coords="map.window.model" options="map.window.options" closeclick="map.window.closeClick()">
</ui-gmap-window>
<ui-gmap-circle ng-repeat="c in circles track by c.id" center="c.center" stroke="c.stroke" fill="c.fill" radius="c.radius" visible="c.visible" geodesic="c.geodesic" editable="c.editable" draggable="c.draggable" clickable="c.clickable" control="c.control"></ui-gmap-circle>
最佳答案
我通过直接在圆数组中设置半径来简单地解决了这个问题(我不觉得这是最好的做法,但它有效。
澄清一下:当距离发生变化时,我调用 setRadius()
函数并通过调用 $scope.circles[0].radius
简单地设置半径,它设置半径。
不需要别的
关于javascript - 在 AngularUI 谷歌地图上动态设置圆的半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39792264/
我有一个包裹在指令中的 angularUi 模式窗口: html: test2 JavaScript: angular.m
谁能向我解释为什么在下面的代码中,$state.go 和 $location.path() 都不起作用? 状态 .state('sheet', { url: "/",
我正在尝试在我的应用程序中包含 angularui 模块化对话框 在我的controller.js中 define([ 'app' ], function(app) { app.controlle
我正在使用 AngularUI 日期选择器。 我有两个相互影响的日期选择器。例如,一个是“开始日期”,另一个是“结束日期”。我不想为两个日期选择器创建验证,而是想消除无效日期的选项(即结束日期早于开始
我正在通过链接调用 Bootstrap 模式对话框。 当对话框弹出时,我想在 Angular Controller 中启动一个计时器。如何检测 Angular Controller 中的对话框打开事件
我有一个预先输入的输入。输入文本设置为在预先输入时选择的选项。但是,在我从预先输入的选项中选择一个选项后,我想清除此文本并在文本框中再次显示“占位符”值(因为我将所选值添加到 selectMatch(
我正在尝试使用 AngularUi 启动单页应用程序,但在使基本示例正常工作时遇到问题。这是我的不同文件: index.html: Student Details App
我最近开始学习 AngularJS,正在研究 Angular UI for Bootstrap 的用途框架。 但是,我在一个非常基本的测试用例中遇到了障碍! Fiddle: My Failing Mo
我正在使用 AngularUI modal在我的应用程序中。模态包含预先填充了一些值的输入字段。要求:当模式打开时,应选择该输入字段中的文本。 我已经为选定的文本输入制定了指令,我得到的最远的是根据
在通过 templateUrl 绑定(bind)的 AngularUI 模态中使用 ngAnimate 时是否存在限制? 我无法让动画在模态中工作。显示和隐藏当然有效,只是没有动画。 最佳答案 也许它
我正在使用 angularUI 来制作选项卡 我没有找到从右到左对选项卡进行排序和对齐的方法 最佳答案 制表符对齐方式是 CSS。默认值是 float :离开选项卡。如果你想要
我正在使用 AngularUI Bootstrap Accordion ,我需要根据来自 $http 请求的数据打开它,这是我的标记:
我知道还有其他问题,但它们似乎没有解决我的问题。 这是我的输出,我认为它应该是 Accordion 我是 Angular 的新手,所以我可能遗漏了一些简单的东西,但我似乎看不到它。这将进入我正在制作的
我正在尝试将 angularJS ui-sortable 绑定(bind)到模型中的特定值,准确地说是列表:field.sort_order。 但似乎无法让它工作,可排序的 js 代码正在工作并在模型
有人可以解释一下如何在打开模式后替换模式中的内容吗?当特定的 websocket 事件被触发时,我正在打开一个模式。 在那次事件之后,我得到了状态更新,我想用这些状态替换模态内容。 我打开模式的代码:
我正在使用 AngularUI 按键指令,但它给我带来了问题。我可以创建一个文本字段并向其附加一个按键事件(基本上这正是 AngularUI 页面上的演示中的内容)。 我正在尝试为页面上的按钮注册热
如标题所示,我想动态更改我的 ui-gmap-google-map 元素上的圆的半径,我尝试在文本框上使用 onChange 函数来请求像这样的半径: HTML Enter a radius 在我的
我有一个非常具体的问题。最近我想出了如何 add a close button to an AngularUI popover 。最初,用户必须单击弹出窗口父级才能打开和关闭它,因此我添加了在单击事件
有谁知道什么是正确的 CSS 选择器(:checked)AngularUI的单选按钮?我试过“选中”、“选中”、“事件”,但这些都不起作用。我需要为 HTML 单选按钮找到一个与 :checked 类
我正在尝试在 angularJS 中创建一个简单的确认弹出窗口。我已经将 AngularUI 用于许多其他组件,这就是为什么它似乎是扩展的自然选择。 我在 plnkr 中创建了一个示例,但我希望能够简
我是一名优秀的程序员,十分优秀!