angularjs-directive

AngularJS - Add computation value from a function to the scope

孤街醉人 提交于 2019-12-22 17:47:32
问题 I have two datepicker fields which is implemented using AngularStrap datepicker directives: http://mgcrea.github.io/angular-strap/. <input type="text" name="startDate" ng-model="startDate" data-date-format="dd/mm/yyyy" placeholder="DD/MM/YYYY" bs-datepicker /> <button type="button" class="btn" data-toggle="datepicker"> <i class="icon-calendar"></i> </button> <input type="text" name="endDate" ng-model="endDate" data-date-format="dd/mm/yyyy" placeholder="DD/MM/YYYY" bs-datepicker /> <button

Inconsistent Data on multiple page printing on a printer

社会主义新天地 提交于 2019-12-22 17:37:24
问题 Requirement To print three(depends on the server response size) pages of print on one button click event. Stored a barcode image an array, and loop through that array and bind the value to ctrl.barCodeImage. Then call the print service to print each bar code in different page. But it print always three same value that is the last value in the array. It is a three separate pages with different bar code data in it. This is the expected response print 1 print 2 print 3 Current response is

Repeat password validation not working

泄露秘密 提交于 2019-12-22 17:21:10
问题 I am trying to validate password and repeat password in a form. Like this import { FormGroup, FormBuilder, Validators, AbstractControl } from '@angular/forms'; this.registerForm = fb.group({ name: ['', Validators.required], email: ['', Validators.compose([Validators.pattern("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"), Validators.required])], passwords: this.fb.group({ password: ['', Validators.compose([Validators.required])], repassword: ['', Validators.compose([Validators.required])

How to set default date in datetimepicker with ngmodel?

喜欢而已 提交于 2019-12-22 13:51:59
问题 I've created this angular directive that wraps a jQuery plugin datetimepicker. How can I get the default dates defined in the controller to display as the default date in the controls? http://jsfiddle.net/edwardtanguay/ef1o3c95/5 I've tried a number of variations with ngModel.$viewValue but can't get the yyyy-mm-dd text to simply display in the control. <div ng-controller="mainController"> <div class="form-group"> <div class='input-group date' timepicker ng-model="date1"> <input type='text'

How to load dynamic inline template with angular

半腔热情 提交于 2019-12-22 13:46:05
问题 I have an ng-repeat that loops over an array of objects. At each loop the value 'template' & 'values' is initialised. The following version works and uses ng-include to load the template but it happens to be very very slow: <tr class="tableRowsDocs" ng-repeat="dbo in rows track by $index"> <div ng-init="values = dbo.get4(attobj.key); key = attobj.key; template = attobj.template || getAttributeTemplate(dbo.clazz + attobj.key);"> <div class="content" ng-include="template"></div> </div> </td> <

How to load dynamic inline template with angular

元气小坏坏 提交于 2019-12-22 13:45:16
问题 I have an ng-repeat that loops over an array of objects. At each loop the value 'template' & 'values' is initialised. The following version works and uses ng-include to load the template but it happens to be very very slow: <tr class="tableRowsDocs" ng-repeat="dbo in rows track by $index"> <div ng-init="values = dbo.get4(attobj.key); key = attobj.key; template = attobj.template || getAttributeTemplate(dbo.clazz + attobj.key);"> <div class="content" ng-include="template"></div> </div> </td> <

AngularJS: Cannot interpolate attribute from first directive to a second. (w/ plunker example)

谁说胖子不能爱 提交于 2019-12-22 12:28:40
问题 Reference Reference plunker: http://plnkr.co/edit/otv5mVVQ36iPi3Mp0FYw?p=preview Explanation of the issue Suppose that we have two directives, first-directive and second-directive . Now suppose we only have access to first-directive which we hope to wrap second-directive with and pass to it our own manipulated attributes. app.directive('firstDirective', function() { return { scope: true, priority: 1000, transclude: true, template: function(element,attributes){ console.log('template') return '

How to add zoom in zoom out buttons in visjs using angularjs?

谁说胖子不能爱 提交于 2019-12-22 10:54:47
问题 Need help in having a zoom in and zoom out button in visjs network graph using angularjs, I could not find any relevant options for this. Please help, I am also providing a plunker link as an example Code <vis-network data="data" options="options" height="100%"></vis-network> $scope.options = { autoResize: true, height: '800', width: '100%' }; 回答1: Take a look at the interaction, navigationButtons option. It has built in controls for zoom, pan and reset view. You need to change your vis

Octal literals are not available when targeting ECMAScript 5 and higher

别来无恙 提交于 2019-12-22 10:47:09
问题 I am building a norwegaian SSN validator in angularjs and getting the error as 'Octal literals are not available when targeting ECMAScript 5 and higher.' but everything works fine in es3 mode ,please help me with the issue module ec.directives { export function norwegianSsnValidator(){ return { restrict: 'A', require: 'ngModel', link: function(scope, element, attrs, ctrl){ ctrl.$validators.invalidSSN = function(ssn:string){ if(typeof ssn !== "string"){ return false; } var pno = ssn, day,

Why directive has scope?

无人久伴 提交于 2019-12-22 10:38:44
问题 As far as I know that basically scope is an instance of a controller. Every time I declare a controller scope will be available for that controller. But then why directive has scope in link function ? I didn't declare any controller for the directive. Then why link function has scope ? Any Idea ? 回答1: From the doc: scope: The scope to be used by the directive for registering watches. You may also be interested to see the differences between $scope and scope. All directives have a scope