angularjs-directive

AngularJs directive with ControllerAs and TypeScript Class

你说的曾经没有我的故事 提交于 2019-12-22 06:37:39
问题 I've written a AngularJs directive with TypeScript to Copy modelValues to the clipboard and the "old" $scope version for directives works fine so far: module App.Directives { interface ICopyToClipboardScope extends ng.IScope { sqValues: ng.INgModelController; copyToClipbaord(): void; } /* * Usage: <div sq-copy-to-clipboard ng-model="viewModel.Name"></div> */ export class CopyToClipboard implements ng.IDirective { public restrict: string = "A"; public replcae: boolean = true; public require =

Angular File Upload directive not updating controller model

删除回忆录丶 提交于 2019-12-22 05:49:06
问题 I am attempting to follow this [tutorial] but can't get it working. My Angular controller is logging undefined for a model created in my directive. Here is a [JSFiddle] of it working created my author of tutorial. The problem is the view can find $scope.myFile and but controller does not ( $scope.myFile is undefined ). The view displays {{ myFile.name }} (as just example my-image.jpg ). The myFile variable is a JS object containing data on selected file. This works fine. The directive seems

Many UI-Bootstrap-Datepickers on page loads very slowly - can I use a single instance and move element?

大憨熊 提交于 2019-12-22 05:45:15
问题 I have many rows displayed using 'ng-repeat'. Each row has 2 x UI-Bootstrap-Datepickers. When there are many rows, the loading of the page gets really slow. I would like to just use a single datepicker and then move it dynamically under the field that the user has clicked into, or possibly load the directive on click and unload it again after a selection has been made. Any ideas on how I can achieve this? <li ng-repeat="ticket in data.tickets"> <div ng-click="openAddStartCal($event, ticket)"

angularjs two directives on one element

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:29:19
问题 I have two directives: // Generated by CoffeeScript 1.6.3 app.directive("focusMe", function() { return { scope: { focus: "=focusMe" }, link: function(scope, element) { return scope.$watch("focus", function(value) { if (value === true) { element[0].focus(); return scope.focus = false; } }); } }; }); and: // Generated by CoffeeScript 1.6.3 app.directive("cleanMe", function() { return { scope: { clean: "=cleanMe" }, link: function(scope, element) { return scope.$watch("clean", function(value) {

Google Maps doesn't load the 2nd time - AngularJS

落爺英雄遲暮 提交于 2019-12-22 05:24:33
问题 I'm using the GoogleMap API ('angular-google-maps' js package) and I have a very weird behavior. The first time I load it, i get the full map loaded, like here: Then i close the dialog and reopen it, i see this: Keep in mind, that the map is displayed as a dialog on top of another dialog. Any ideas? 回答1: If you are using Angular Google Map module you must add the refresh attribute to the googlemap element. As it written in the Module documentation: refresh = "expression" - Expression which,

Attribute without value in AngularJS directive

放肆的年华 提交于 2019-12-22 05:24:27
问题 I've written a directive with an isolate scope. app.directive('myDirective', function() { return { restrict: 'E', scope { attr1: '@', attr2: '@', noValueAttr: // what to put here? }, link: function(scope, elem, attrs) { // how to check here if noValueAttr is present in mark-up? } }; }); the html could be <my-directive attr1='...' attr='...' ... no-value-attr> or <my-directive attr1='...' attr='...' > I am wondering how to use (and have the directive detect if it's there or not) an optional

Google Maps doesn't load the 2nd time - AngularJS

◇◆丶佛笑我妖孽 提交于 2019-12-22 05:24:13
问题 I'm using the GoogleMap API ('angular-google-maps' js package) and I have a very weird behavior. The first time I load it, i get the full map loaded, like here: Then i close the dialog and reopen it, i see this: Keep in mind, that the map is displayed as a dialog on top of another dialog. Any ideas? 回答1: If you are using Angular Google Map module you must add the refresh attribute to the googlemap element. As it written in the Module documentation: refresh = "expression" - Expression which,

Set validity of multiple inputs from a AngularJS Directive

只谈情不闲聊 提交于 2019-12-22 05:21:46
问题 I'm trying to create a directive which can be used to reset validation status of multiple input controls in a group, when one of the control's value is changed. Groups are identified by the attribute of the directive set in HTML. Ex: - Both of the From Date and To Date inputs resets the validity state when one of the controls input value is changed by the user This is what I have so far JS/Angular angular.module('myModule').directive('groupedInputs', function () { return { restrict: 'A',

AngularJS set element fixed position based on another element

[亡魂溺海] 提交于 2019-12-22 05:06:18
问题 This app takes an image, which is essential a background, or workspace. I need to add input text fields onto this workspace given specific coordinates (top, left, width, height). These coordinates would be relative to the image (top/left = 0/0). How would I position my fields/elements relative to the image? <img id="background" ng-src="{{page.backgroundImage}}" /> <input type="text" ng-repeat="field in page.fields" ng-model="field.value" ng-style="{position:'absolute', left:field.left, top

ui.bootstrap deforms the <progress> HTML tag

谁说胖子不能爱 提交于 2019-12-22 04:46:34
问题 In my HTML file I have a <progress> tag and I also injected the ui.bootstrap dependency to my controller as follows: var myApp = angular.module("myApp",["ui.bootstrap"]); In this configuration, AngularJS converts the <progress></progress> into: <div class="progress ng-isolate-scope" ng-transclude=""></div> When I remove "ui.bootstrap" it works fine. You can play out with this sample JSFiddle. When progress turned into <div class="progress ng-isolate-scope" ng-transclude=""></div> it