我在当前项目中使用angular-ui-bootstrap,我需要一个允许用户对给定元素执行某些操作的popover(重命名/编辑/删除/等...).由于angular-ui的bootstrap popover默认情况下不允许自定义html或数据绑定,我已经复制了他们的工具提示/ popover,.provider并.directive努力根据我的需要进行自定义.
主要问题:弹出窗口关闭并重新打开后,ng-click绑定正在丢失.
次要问题:是否可以设置双向数据绑定,以便我不必手动设置scope.$parent.$parent.item?
Plunker:http://plnkr.co/edit/HP7lZt?p = preview
要了解对原始内容所做的更改tooltip.js:
.directive是最经过修改的:.directive('iantooltipPopup', function () {
return {
restrict: 'E',
replace: true,
scope: { mediaid: '@', title: '=', content: '@', placement: '@', animation: '&', isOpen: '&' },
templateUrl: 'popover.html',
link: function (scope, element, attrs) {
scope.showForm = false;
scope.onRenameClick = function () {
console.log('onRenameClick()');
scope.showForm = true;
};
scope.onDoneClick = function () {
console.log('Title …Run Code Online (Sandbox Code Playgroud) 我正面临着anular-ui-bootstrap模态指令的问题.我在我的应用程序中使用angular的ui-select组件作为html选择的替代品.这个ui-select在包含的任何页面中都能正常工作.但是当我试图将它包含在模态弹出窗口中时(使用ui-bootstrap $ modal服务),下拉列表不会显示选项
这个问题在这里转载
angular.module('ui.bootstrap.demo').controller('ModalInstanceCtrl', function ($scope, $modalInstance, items) {
$scope.addresses = [{
"id":1,
"name": "chennai"
}, {
"id":2,
"name": "banglore"
}, {
"id":3,
"name": "madurai"
}];
});Run Code Online (Sandbox Code Playgroud)
<div class="modal-body">
City
<ui-select ng-model="selAddress">
<ui-select-match placeholder="Choose an address">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="address in addresses track by $index" refresh-delay="0">
<div ng-bind-html="address.a | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
Selected: <b>{{ selAddress }}</b>
</div>Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激.提前致谢.
有没有办法使用AngularJS/Angular-UI在输入控件中设置焦点?
我看到Angular-UI有一些Jq-UI =焦点指令,但我无法让它工作.
我有一些使用Angular-UI $对话框服务显示的对话框,并且非常希望每个对话框上的第一个输入在获得焦点后获得焦点
问题:
我无法使用ENTER键接受模态窗口
我修改了默认的Plunker来向你展示我从现在开始做的事情 - > 这里
我拥有:
简而言之,模式识别ENTER键,但它不会触发我的功能(范围问题,我怀疑).
不好的是,我必须修改template/modal/window,如果可能的话,我很乐意保留未受污染的.
我
想要的只是简单地将ng-enter指令放在我的模态中,而不修改默认模板
额外
我还尝试将"事件13"添加到modal指令中,但我无法传递任何结果modal.close,所以我放弃了这条道路
任何想法?
我Angularjs UI bootstrap用来在我的项目中渲染模态窗口.但在某些情况下,我想在模态加载后调用一个函数.我曾尝试与$timeout和$viewContentLoaded,但没有用.任何人都可以帮我解决这个问题.
谢谢你们.
我正在使用UI Boostrap扩展模块(http://angular-ui.github.io/bootstrap).该模块实际上用作加载对话框,并在将一组Web服务数据返回到我的Angular代码时自动关闭.当自动加载此页面上的数据时,会立即显示该对话框.
当我第一次点击有问题的页面或者只是刷新它时,这一切都很有效.当我进入更深的页面,然后尝试通过浏览器的后退按钮导航回原始页面(使用对话框)时,会出现问题.尽管返回了所有数据并且已经进行了模块的dismiss()调用,但对话框永远不会消失.
我已经追溯到承诺打开对话框似乎在解雇呼叫后发生,但是,再次,只有当页面通过后退按钮加载时.解雇调用永远不会关闭任何东西,因为它尚未添加(我已在调试器中确认了这一点).
我的问题是如何处理这个问题?是否有一种可靠的方法来捕获通过Angular完成页面加载并仔细检查对话框是否已关闭?通过UI Bootstrap的api有更好的方法吗?
我知道这是一个相当不寻常的案例,但任何想法都会很棒.
谢谢!
我正在使用Angular-ui typeahead组件来命中自动完成API,而我正在解析我回到一个名为的数组中的数据resp.但是,我没有看到数据传递到UI中的自动完成下拉列表.顺便说一句,控制器有一个console.log,可以正确显示数据,所以我知道它从api调用返回.
这是我的控制器功能:
$scope.getLocationForSearch = function(locationString){
$scope.locationString = locationString;
var url = '/autoComplete/' + locationString ;
$http({
method: 'GET',
url: url
}).then(function successCallback(response) {
console.clear();
var resp = response.data.RESULTS.map(function(item){
console.log(item.name);
return item.name;
});
return resp;
}, function errorCallback(response) {
console.log(response);
});
}
Run Code Online (Sandbox Code Playgroud)
在我的HTML中:
<div class="input-group">
<input
type="text" class="form-control" ng-model="asyncSelected" placeholder="Search city or zip code"
uib-typeahead="item for item in getLocationForSearch($viewValue)"/>
<i ng-show="loadingLocations" class="glyphicon glyphicon-refresh"></i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i> No Results Found
</div>
<span class="input-group-btn">
<button class="btn btn-default" name="search" …Run Code Online (Sandbox Code Playgroud) javascript angularjs angular-ui-bootstrap angular-ui-typeahead
我有一个动态标签集,从一个空白开始的数组生成标签.当我向数组添加新项目时,它将显示为新选项卡.我希望最后添加的标签是活动标签.每次我向数组添加项目时都会设置活动索引
HTML:
<uib-tabset active="activeTabIndex">
<uib-tab ng-repeat="tab in tabs" heading="{{tab.title}}">Some content</uib-tab>
</uib-tabset>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
$scope.activeTabIndex = 0
$scope.tabs = [];
$scope.addTab = function() {
var newTab = { title: 'Tab ' + ($scope.tabs.length + 1) };
$scope.tabs.push(newTab);
$scope.activeTabIndex = ($scope.tabs.length - 1);
console.log($scope.activeTabIndex);
};
Run Code Online (Sandbox Code Playgroud)
这是演示的完整源代码的Plunk:https://plnkr.co/edit/TX6ek4R62AfM2zUXcoC3?p = preview
问题是它似乎仅使用奇数个选项卡.这就是我的意思:
在初始加载时,它看起来像这样:
添加新标签后,它会正确显示活动标签:
当我添加另一个时,没有任何内容被选中,并且activeTabIndex变量变为未定义:
在第3天它再次开始工作:
因此,对于偶数活动索引号(0,2),它工作正常.但不知何故,而不是Acitve Index:1它显示为空白,并没有设置活动标签.我将变量写入控制台,它正确显示所有值.
欢迎任何帮助/指针/想法.
谢谢.
我在Plunker上使用此自定义指令使用Angular UI引导日期选择器弹出窗口(http://plnkr.co/edit/053VJYm1MpZUiKwFTfrT?p=preview):
//Module
var userModule = angular.module("userModule",['ui.bootstrap']);
//Controller
userModule.controller("sampleController", ['$scope', function ($scope) {
$scope.minDate = new Date();
}]);
//Directive code
userModule.directive('datePicker', [function (dateFilter) {
return {
restrict: 'E',
require: 'ngModel',
scope: {
ngModel: '=',
ngReadonly: '=?',
minDate: '=?',
maxDate: '=?',
dtpRequired: '=?',
dateOptions: '=?'
},
template: '<p class="input-group">' +
'<input type="text" style="cursor:pointer" class="form-control" datepicker-popup="{{format}}"' +
'ng-model="ngModel" is-open="opened"' +
'min-date="minDate" max-date="maxDate"' +
'datepicker-options="dateOptions" date-disabled="disabled(date, mode)"' +
'ng-required="dtpRequired" close-text="Close" ng-readonly="ngReadonly" ng-click="openPopup()" />' +
'<span class="input-group-btn">' +
'<button type="button" class="btn btn-default" …Run Code Online (Sandbox Code Playgroud) html javascript angularjs angularjs-directive angular-ui-bootstrap
当我从 Angular cli 运行我的项目时。它向我显示了这个错误。(附图)。
我已经更新了我的 node_module 文件并搜索了许多其他平台,但是......
options should NOT have additional properties
options should pass "instanceof" keyword validation
options should match exactly one schema in oneOf
ValidationError: Progress Plugin Invalid Options
options should NOT have additional properties
options should pass "instanceof" keyword validation
options should match exactly one schema in oneOf[![enter image description here][1]][1]
Run Code Online (Sandbox Code Playgroud)