directive

How to disable a warning in Delphi about “return value … might be undefined”?

大憨熊 提交于 2019-12-09 15:59:00
问题 I have a function that gives me the following warning: [DCC Warning] filename.pas(6939): W1035 Return value of function 'function' might be undefined The function, however, is clean, small, and does have a known, expected, return value. The first statement in the function is: Result := ''; and there is no local variable or parameter called Result either. Is there any kind of pragma-like directive I can surround this method with to remove this warning? This is Delphi 2007. Unfortunately, the

Append html to an element in directive and make a local function to interact with it

泄露秘密 提交于 2019-12-09 14:05:44
问题 In my AngularJS application, I have different complex inputs everywhere. For example, some inputs have a directive to use autocompletion with Google Places or with autocompletion from Twitter Bootstrap. I'm searching for a way to make a directive which displays an erase button when we add some text like iOS feature. I made this one, but the scope.erase doesn't start, nor does the ng-show . Is it possible to add HTML after the text input and "play" with them inside the controller? My test: app

angular ng-repeat expressions as variables

冷暖自知 提交于 2019-12-09 02:38:25
问题 I'm trying to do something like this: <ul> <li ng-repeat="{{myRepeatExpression}}">{{row.name}}</li> </ul> But because the ng-repeat logic is in the compile state of the directive it treats the {{myRepeatExpression}} as a normal string instead of a variable. Which doesn't work, obviously. Is there any workaround for that? 回答1: You can only use and expression with ng-repeat and not an interpolated value. Now in order to create a dynamic repeatable list you can try either: using a function that

angularjs custom form and field directive: ngModelController is not found in FormController

荒凉一梦 提交于 2019-12-08 10:04:43
问题 I have 2 directives, one is my-form, one is my-field. I need to use the mode of dynamically creating the html content for both of these two directives. Everything works well except I can not get the ngModelController of the input fields. So I can not get the $dirty, $valid properties of these fields. For example, when submitting, I want to get the ngModelController of the input with name "field1", but I can not get it. form.field1 is undefined. In the FormController "form1", there is no field

Angularjs: Form validation on input field generated by directive

落花浮王杯 提交于 2019-12-08 05:57:55
问题 I have built a directive that generates an input field based on meta ( $scope.meta ) data. My problem is supporting angular's Form validation. Plunkr: http://plnkr.co/edit/AfR5cWyywGlCECS6h6Dr?p=preview Explanation: directive takes a meta parameter which describes what input field type it is and other related information to render the field. All the attributes defined on directive will be copied to element and finally will replace the directive after compilation and linking. View: <form name=

AngularJS - Directive two way binding not working with ISOLATED Scope

给你一囗甜甜゛ 提交于 2019-12-08 04:05:39
问题 I am building a demo weather app, by using controller/provider & 2 directives,( with isolated scope, one directive for rendering week worth forecast & another directive to display clicked weekday forecast on top of the page). On click on one of the week days I am trying to show clicked weekday on top of the screen. This works fine if I remove Isolated scope in directives however it does not work with isolated scope in place. Can anyone please suggest what I am missing here? Link: A directive

Close nested UI Bootstrap accordion when parent closes

▼魔方 西西 提交于 2019-12-08 02:53:18
问题 In AngularJS I am using a bootstrapUI accordion directive that contains a nested accordion in one of the panes. When I close the 'parent' I would like to close its 'children'. I am having trouble because the accordion directive uses transclusion, and the scopes are actually siblings not parent to child. <div ng-controller="AccordionDemoCtrl"> <accordion close-others="oneAtATime"> <accordion-group heading="Static Header"> This content is straight in the template. </accordion-group> <accordion

Update real time d3 chart by socket.io

天涯浪子 提交于 2019-12-07 23:11:32
问题 I am writing a d3.js-based real time chart directive. The structure looks like this: myDirective.js : app.directive('myDirective', function(socketio) { return { restrict: 'EA', templateUrl: '../../views/partials/chart.html', controller: DataController, link: function(scope, elem, attrs, ctrl) { scope.Watch = scope.$watch(function() { return ctrl.data; }, function(newVal) { // d3 code part }); socketio.on(event, function(newdata) { ctrl.data.push(newdata); // redraw chart }); } }; }); In the

Angular Directive: link vs compile vs controller

十年热恋 提交于 2019-12-07 17:20:21
Compile : This is the phase where Angular actually compiles your directive. This compile function is called just once for each references to the given directive. For example, say you are using the ng-repeat directive. ng-repeat will have to look up the element it is attached to, extract the html fragment that it is attached to and create a template function. If you have used HandleBars, underscore templates or equivalent, its like compiling their templates to extract out a template function. To this template function you pass data and the return value of that function is the html with the data

Communication between custom directive and component in Angular2

纵饮孤独 提交于 2019-12-07 05:20:41
问题 I have a template which has textbox, one 'span' tag and one 'div' tag. 'div' tag has 'selectedColor' custom directive. I want to change background color of 'span' and 'div' tags when input value is changed. So finally I want my directive to react on input change and sets background color of 'div' tag. I also want to change 'span' background color on input value change event. Plunker boot.ts import {Component,bind} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser';