angularjs-directive

Angular removing / from strings within Directive - seems to butcher html

人走茶凉 提交于 2019-12-11 19:41:26
问题 I'm having an issue (just learning Angular) with a string having any / removed and replaced with ="" . I have a directive that takes it's element and then wraps it with a div and provides some styling to the div - namely a background-url - it is the URL that is being replaced with something else. It may be a little odd - what I am actually trying to do here - and that's ok; i'm just trying to learn a little more about Angular and simple manipulation of elements seems a good place to tinker..

Angular js Custom Directive on element with ng-repeat - Can't set CSS classes

本秂侑毒 提交于 2019-12-11 19:37:06
问题 I'm trying to use a custom directive on an element with ng-repeat, like so: <article ng-repeat="product in ctrl.products" class="product entity" product="product" selected-retailer="ctrl.selectedRetailer"></article> I've read that, in order for this to work, you need to set the priority on your custom directive to something higher than the ng-repeat directive. So I've defined my directive like so, setting the priority to 1001: angular.module('MainApp') .directive('product', function () {

Extract time from datetime using Angular js

℡╲_俬逩灬. 提交于 2019-12-11 19:33:45
问题 I need to extract the hour and minute from the datetime(eg:2013-09-03 05:02:04) using Angular js.I have done like this. JSON Data: { "status": "success", "data": [ { "PriorityPassReservation": { "site_id": "8", "id": "235907", "priority_pass_schedule_id": "4", "member_id": null, "member_guid": "8-853414", "reservation_dt": "2013-09-05 19:00:00", "checkin_dt": null, "reminder_sent": "0", "created": "2013-09-03 05:02:04", "modified": "2013-09-03 05:02:04", "status": "booked" } ] } HTML: <tr ng

AngularJS input with focus kills ng-repeat filter of list

有些话、适合烂在心里 提交于 2019-12-11 19:19:59
问题 Obviously this is caused by me being new to AngularJS, but I don't know what is the problem. Basically, I have a list of items and an input control for filtering the list that is located in a pop out side drawer. That works perfectly until I added a directive to set focus to that input control when it becomes visible. Then the focus works, but the filter stops working. No errors. Removing focus="{{open}}" from the markup makes the filter work. The focus method was taken from this

AngularJS : Testing directive, HTML not re-rendered after promise completion

强颜欢笑 提交于 2019-12-11 19:07:14
问题 I am writing some basic unit tests for my AngularJS app. I have some bindings on the UI with a scope variable inside my directive whichis populated on the completion of a promise. HTML: <div id="parent"> <div id="child" ng-repeat="l in aud"> // Other Stuff </div> </div> Directive: link: function(scope){ service.getArray().$promise.then(function(data){ scope.aud = data; } Test: describe('my module', function () { var $compile: ICompileService, $rootScope: IScope, directive: JQuery<HTMLElement>

watch changes on JSON object properties

筅森魡賤 提交于 2019-12-11 18:24:07
问题 I'm trying to implement a directive for typing money values. var myApp = angular.module('myApp', []); var ctrl = function($scope) { $scope.amount = '0.00'; $scope.values = { amount: 0.00 }; }; myApp.directive('currency', function($filter) { return { restrict: "A", require: "ngModel", scope: { separator: "=", fractionSize: "=", ngModel: "=" }, link: function(scope, element, attrs) { if (typeof attrs.separator === 'undefined' || attrs.separator === 'point') { scope.separator = "."; } else {

401 Unatuhorized(“detail”:“Authentication credentials were not provided.”)

蹲街弑〆低调 提交于 2019-12-11 18:16:57
问题 i am using djoser's authentication at backend. when i make a get request at "/account/me/" through post man with content-type and Authorization header i am getting a correct response. But when i try to do same request from my angular client i get 401 Unatuhorized("detail":"Authentication credentials were not provided.") error. here is my angular service import { Injectable } from '@angular/core'; import {homeUrls} from "../../../utils/urls"; import {Http, RequestOptions, Headers Response}

ng-model for the custom directive Angular

老子叫甜甜 提交于 2019-12-11 17:58:18
问题 Problem Question, I have a custom datepicker directive and want to link ng-model to it in the view. <div my-date-picker ng-model="date"> {{date}} </div> the ng-model {{date}} does not display can anyone please tell me what i am doing wrong I have plunker created http://plnkr.co/edit/bWpNITdjBLZJO1p221xe?p=preview. 回答1: you are using <div my-date-picker ng-model="date"> datepicker dirctive that means your going to replace inside of this div, by the template in the directive so your {{ Date }}

Firebase: Email verification and user login to be able to access the page

喜欢而已 提交于 2019-12-11 17:58:05
问题 I have created a form "main.html#!/register" to allow users to enter their: firstname, lastname, email and login. Once all those entered an email verification is sent, so that they cannot get to the page "main.html#!/success" before verifying the email. The good news is : If they try to get to the access page from the login page without confirming the Email, they will not be able to access. The bad news is : Right after the registration, if they enter the "main.html#!/success" they will be

How to route using ngRoute (with Demo)

心不动则不痛 提交于 2019-12-11 17:33:21
问题 My code starts from here <!DOCTYPE html> <html> <head> <title>Routing</title> </head> <body ng-app="myApp"> <a href="#/login">Login</a> <a href="#/register">Register</a> <div ng-view></div> </body> <script src="angular-min.js" type="text/javascript"></script> <script src="angular-route.js" type="text/javascript"></script> <script> var app = angular.module("myApp", ["ngRoute"]); app.config(function($routeProvider) { $routeProvider .when("/login", { templateUrl : "login.html" }) .when("