angularjs-directive

AngularJS : Watch element.html() in a directive

ε祈祈猫儿з 提交于 2019-12-21 06:41:38
问题 I am looking to create a mardown directive (restrict A) which would make me able to use same recipient for ng-view . So I would basically load only .md files in views and apply my function on its content each time ng-view change. So : index.html <div markdown ng-view></div> with two views containing, let say, view1.md #That should be h1 and view2.md ##That should be h2, no ? My actual code is 'use strict'; angular.module('btford.markdown', []). directive('markdown', function () { var

in a directive, $watch fires two times reverting newValue to the original pre $watch firing value

南笙酒味 提交于 2019-12-21 06:31:49
问题 I'm pretty sure I'm doing something wrong because of my little experience with angular. Probably the answer is already somewhere in stackoverflow, and I'm not asking (googling) the right questions. I have this pretty simple directive. It's just a span with four states, that I want to change on every click on the span. Every click progresses the state forward and then loops back. Every state has a different css class. I want the values changed on the parent model everytime the value of the

in a directive, $watch fires two times reverting newValue to the original pre $watch firing value

对着背影说爱祢 提交于 2019-12-21 06:31:05
问题 I'm pretty sure I'm doing something wrong because of my little experience with angular. Probably the answer is already somewhere in stackoverflow, and I'm not asking (googling) the right questions. I have this pretty simple directive. It's just a span with four states, that I want to change on every click on the span. Every click progresses the state forward and then loops back. Every state has a different css class. I want the values changed on the parent model everytime the value of the

Angular 2/4 : How to check length of input's value using directive?

最后都变了- 提交于 2019-12-21 06:06:41
问题 I've created one custom attribute directive that can validate input, It has value or not. Please refer below code. I don't know why if condition is not working, in console.log it is showing 0 only. is there anything wrong in my code? I tried with other angular's app lifecycle event too. Thanks! import { Directive, ElementRef, Input, AfterContentInit ,Renderer } from '@angular/core'; @Directive({ selector: '[inputfocus]' }) export class InputFocusedDirective implements AfterContentInit {

Dynamically changing Leaflet map bounds in Angular?

こ雲淡風輕ζ 提交于 2019-12-21 05:45:06
问题 I'm using Angular-leaflet-directive. I have a menu where the user taps an option. Each time the user clicks an option the map is updated with two new markers and the bounds should be adjusted so these markers are both visible. The markers get updated but the bounds seem to work differently. The first time the user clicks something the bounds are updated, but they don't update for each time after that. This is the code which is called each time the user selects an option: var updateMap =

Issue with isolated scope and “replace: true” in angular directive

白昼怎懂夜的黑 提交于 2019-12-21 04:53:14
问题 I have been struggling with a scoping issue when making an error message directive using AngularJS. I have an ng-if and ng-class directive as part of the directive template, but the expression in the ng-class directive always seemed to return a blank string, unless: I removed the ng-if directive. or, I removed the 'replace' key in the directive definition object. Looking at the compiled output for my directive, it looks like an isolated scope is being created if the ng-if or the replace key

Selenium does not see AngularJS page elements

孤街浪徒 提交于 2019-12-21 04:31:41
问题 I have problem with writing Selenium test to check my application. What I want to test is when user types correct login/password, correct page is shown and user is logged in. The main issue is that my login form is generated as a AngularJS directive (I have two different login pages and this directive is reused in both places) and Selenium seems to be unable to see elements from this directive-generated markup. What is most important, tests were passing on this page before I've replaced

Binding ngModel to a custom directive

假如想象 提交于 2019-12-21 04:29:08
问题 So I have been working on this issue for a week now and i cannot seem to get my head around this whole Directive thing. I have read lots of posts ... Demystifying Directives Directives Compile, Pre and Post Linking a bunch of videos ... Creating Reusable Directives in AngularJS Writing Directives And gone through StackOverflow and other forums (links to follow) hoping something will sink in ... I think that the problem that I am running into is that I want to UNDERSTAND why/how these work so

AngularJS: ng-src behavior on non-standard attributes?

时间秒杀一切 提交于 2019-12-21 03:29:23
问题 I'm integrating a media player in my app using the "Video For Everybody" generator. As the player features a fallback to flash if the browser doesn't support HTML5 video and audio I have to build an object element with param attributes with the video and placeholder (image) source. As expected I run into the classical problem of expressions not being resolved in time, my browser sends requests to my.media.com/{{video.src}} rather then my.media.com/somevideo.mp4 Unfortunately there are several

How would I test a $scope.watch (AngularJS) change in Jasmine?

我的梦境 提交于 2019-12-21 03:08:12
问题 I've just recently started writing something with AngularJS and I'm not sure how to go about writing a test for this particular thing. I'm building a "Help Request" mode that has different states. So in my controller, I use a $scope.request_mode variable. The different links to activate help requests set that variable to something differently. Then inside my directive, I'm doing a $scope.$watch('request_mode', function(){...}); to selectively activate or deactivate things as the request mode