directive

AngularJS - Append element to each ng-repeat iteration inside a directive

笑着哭i 提交于 2019-11-29 23:03:38
问题 I'm using a ng-repeat inside a <tr> element together with a directive. Html: <tbody> <tr ng-repeat="row in rows" create-table> <td nowrap ng-repeat="value in row | reduceString>{{value}}</td> </tr> </tbody> Directive: app.directive('createTable', function () { return { link: function (scope, element, attrs) { var contentTr = scope.$eval('"<tr ng-show="false"><td>test</td></tr>"'); $(contentTr).insertBefore(element); } } } ); Although I can append a new <tr> element to each iteration, I'm not

AngularJS ng-model form driven by ng-repeat over UI model description data how to?

不打扰是莪最后的温柔 提交于 2019-11-29 16:26:27
The JSFiddle http://jsfiddle.net/vorburger/hyCTA/3/ illustrates a (working) "UI modeling" idea I had with AngularJS; note the form is not actually coded out in the HTML template, it's driven by uimodel JSON (which in turn describes how the datamodel is to be rendered/edited): <div ng-repeat="auimodel in uimodel"> <label>{{$index + 1}}. {{auimodel.label}}</label> <input ng-model="datamodel[auimodel.model]" type="{{auimodel.type}}" /> </div> Trouble is, as soon as my 'model' isn't a simple property, but a 'path', then my square bracket dynamic keys 'trick' doesn't work anymore of course.. as

Using @import in objective C in conjunction with __cplusplus

我的未来我决定 提交于 2019-11-29 13:10:57
问题 When I try to compile an Objective C++ file (.mm) that is linked to a file that uses the new @import directive, I get some errors. Currently, my only solution is to replace the @import with the old #import directive. Is there any other solution so I can still use @import? 回答1: Edit : According to the latest docs this should work now. See this. You have to use the -fcxx-modules flag instead of the -fmodules flag, but as the official documentation suggests - EXPERIMENTAL and VERY BROKEN . I

Dynamically update ion.rangeSlider ngModel in AngularJS directive

给你一囗甜甜゛ 提交于 2019-11-29 12:11:58
I'm trying to update the value of an Ion.RangeSlider when its bound ng-model scope variable changes. The model updates when the Ion.RangeSlider is used, but not vice-versa. Other inputs with the same ng-model update when the model value changes, so this must be some special case. Edit: Woo! Here's a snippet @lin :) Also jsfiddle . var app = angular.module('ngModelIonRangeSliderDemo', []); app.controller('MainCtrl', function ($scope, $rootScope, $timeout) { $scope.someNumber = 10; }).directive('ionRangeSlider', function ionRangeSlider() { return { restrict: 'A', scope: { rangeOptions: '=',

How do I access the directive instance in angular from console?

喜你入骨 提交于 2019-11-29 11:15:17
ng.probe($0).componentInstance -- will give the reference to the instance. Is there any way to access the directive instance from the console? Directive instance doesn't differ from other providers in this respect, it can be retrieved from injector. In order to retrieve provider instance, it is necessary to have provider token, which is directive class. Since application classes aren't exposed to global scope, debug element providerTokens can be inspected. Given the application is unminified and functions preserve their original names, directive (provider) token is retrieved like: var

PHP log will not ignore repeated errors with ignore_repeated_errors = On

依然范特西╮ 提交于 2019-11-29 10:56:04
Although I have instructed php to only log an error once - i see the error over and over again in my log file. Any ideas why this directive would get ignored? I've restarted apache, etc. This directive will only stop the error from being logged again within the same script run . When the same script is run multiple times, you will still see that error every time. Besides the ignore_repeated_errors , there is also the ignore_repeated_source ini settings. I think that one would work for you and should stop showing the same error repeatedly, when same file is called over and over. As PHP manual

Passing array via attribute to AngularJS directive

喜欢而已 提交于 2019-11-29 10:32:05
问题 I'm currently having a problem when passing an array to a directive via an attribute of that directive. I can read it as a String but i need it as an array so this is what i came up with but it doesn't work. Help anyone? thks in advance Javascript:: app.directive('post', function($parse){ return { restrict: "E", scope:{ title: "@", author: "@", content: "@", cover: "@", date: "@" }, templateUrl: 'components/postComponent.html', link: function(scope, element, attrs){ scope.tags = $parse(attrs

Prevent `ng-include` from creating isolated scope. AngularJS

自古美人都是妖i 提交于 2019-11-29 06:47:01
I am using ng-include src directive at multiple places in my HTML. Each ng-include is creating an isolated scope for itself which apparently is causing a lot of trouble for me. For example. <div ng-controller="parent"> <div ng-include src="'id1'"> </div> <div ng-include src="'id2'"> </div> <div ng-include src="'id2'"> </div> </div> In the html mentioned above, 4 scopes are getting created. 1 at parent where controller is defined and 3 are getting created by default at each ng-include src . Is it at all possible to prevent ng-include from creating an isolated scope for itself? If It is not

How to add validation attributes in an angularjs directive

穿精又带淫゛_ 提交于 2019-11-29 06:12:19
I am trying to write an angular directive that adds validation attributes to the tag, but it doesn't seem to be working. Here is my demo. You will notice that "Is Valid" remains true if you delete the text in the second input box, but goes to false if you delete the text in the first input box. http://plnkr.co/edit/Rr81dGOd2Zvio1cLYW8D?p=preview Here is my directive: angular.module('demo', []) .directive('metaValidate', function () { return { restrict: 'A', link: function (scope, element, attrs) { element.attr("required", true); } }; }); I'm guessing I am just missing something simple. All

AngularJs学习笔记--concepts(概念)

佐手、 提交于 2019-11-29 04:56:20
启动( Startup ) 下面描述 angular 是如何启动的(参考图表与下面的例子): 1. 浏览器加载 HTML ,将 HTML 标签转换为 DOM 对象; 2. 浏览器加载 angular.js 的脚本; 3. Angular 等待 DOMContentLoaded 事件; 4. Angular 寻找 ng-app 这个用于指定应用边界范围的 directive ; 5. 如果 ng-app 有指定 module (也许是 ng-app= ”SomeApp”),将被用作配置 $injector ; 6. $injector 用于创建 $compile 服务( service )以及 $rootScope ; 7. $compile 服务用作“编译”(有点像遍历,然后做一点神秘的事情) DOM ,并将其与对应的 $rootScope 连接。 8. ng-init 这个 directive 在对应的 scope 中创建 name 属性并对其赋予 ”Kitty”值; 9. 将“{{name}}”的值插入 (interpolates) 到表达式中,最终显示 ”Hello Kitty!”。 <!DOCTYPE html> <html ng-app> <head> <meta charset="UTF-8"> <title>Hello Kitty!</title> <style