directive

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

痴心易碎 提交于 2019-12-03 22:19:28
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.directive('eraseBtn', function($parse, $compile){ return { require: 'ngModel', restrict: "A",

Angular2 Can't bind to DIRECTIVE since it isn't a known property of element

牧云@^-^@ 提交于 2019-12-03 19:46:20
问题 I generated new @Directive by Angular CLI, it was imported it to my app.module.ts import { ContenteditableModelDirective } from './directives/contenteditable-model.directive'; import { ChatWindowComponent } from './chat-window/chat-window.component'; @NgModule({ declarations: [ AppComponent, ContenteditableModelDirective, ChatWindowComponent, ... ], imports: [ ... ], ... }) and I try to use in my component (ChatWindowComponent) <p [appContenteditableModel] > Write message </p> even if within

How to use Angular structural directive with multiple inputs

我的未来我决定 提交于 2019-12-03 18:45:48
问题 I want to implement something similar with angular-permisssion. And with requirement to control the element's existance, I need to use angular structural directive. At the beginning, i think such syntax would work: <h2 *permissionIf [permissionIfExcept]="'Read'">Except</h2> However, it doesn't work that way. Moreover, the offical guide only teach you how to write custom structural directive with single input. With multi-inputs, some third-party tutorials involve a bit. But that's using the

vue自定义全局指令directive和钩子函数

和自甴很熟 提交于 2019-12-03 14:28:20
一、directive 使用自定义全局指令实现文本框获取焦点功能 二、实例 <!-- 注意: Vue中所有的指令,在调用的时候,都以 v- 开头 --> <input type="text" class="form-control" v-model="keywords" id="search" v-focus > // 使用 Vue.directive() 定义全局的指令 v-focus // 其中:参数1 : 指令的名称,注意,在定义的时候,指令的名称前面,不需要加 v- 前缀, // 但是: 在调用的时候,必须 在指令名称前 加上 v- 前缀来进行调用 // 参数2: 是一个对象,这个对象身上,有一些指令相关的函数,这些函数可以在特定的阶段,执行相关的操作 Vue.directive('focus', { // 注意: 在每个 函数中,第一个参数,永远是 el ,表示 被绑定了指令的那个元素,这个 el 参数,是一个原生的JS对象 inserted: function (el) { // inserted 表示元素 插入到DOM中的时候,会执行 inserted 函数【触发1次】 el.focus() // 和JS行为有关的操作,最好在 inserted 中去执行,放置 JS行为不生效 }, }) 三、钩子函数 一个指令定义对象可以提供如下几个钩子函数 (均为可选): bind

.NET Core 3.0 Preview 6中对ASP.NET Core和Blazor的更新

易管家 提交于 2019-12-03 11:51:09
我们都知道在6月12日的时候微软发布了.NET Core 3.0的第6个预览版。针对.NET Core 3.0的发布我们国内的微软MVP-汪宇杰还发布的官翻版的博文进行了详细的介绍。具体的可以关注“汪宇杰博客”公众号,或者我的“DotNetCore实战”公众号然后在历史文章里面进行查阅。而我们这篇文章将会介绍本次更新中对ASP.NET Core和Blazor所做的更新。当然本文的大部分内容翻译自ASP.NET的首席项目经理 Daniel Roth 的介绍。 注:英语能力好的可以直接到文章末尾查看英文链接进行阅读。 作者:依乐祝 本文链接:https://www.cnblogs.com/yilezhu/p/11031441.html 以下是此预览版中的新增功能列表: 新Razor特性:@attribute,@code,@key,@namespace,@functions中的标记 Blazor指令属性 Blazor应用程序的身份验证和授权支持 Razor类库中的静态资产 Json.NET不再在项目模板中引用 证书和Kerberos身份验证 SignalR自动重新连接 托管gRPC客户端 gRPC客户端工厂 gRPC拦截器 有关其他详细信息和已知问题,请参阅 发行说明 。 开始 要在.NET Core 3.0 Preview 6中开始使用ASP.NET Core, 请安装.NET

Angular testing using passThrough in unit testing

烈酒焚心 提交于 2019-12-03 11:35:11
I'm trying to test a Directive in Angular, but I can't get the corresponding template to work. The directive lists the templateUrl like so templateUrl: 'directives/listview/view.html' Now when I write any unit-test, I get Error: Unexpected request: GET directives/listview/view.html So I have to use the $httpBackend and respond with something sensible like httpBackend.whenGET('directives/listview/view.html').respond("<div>som</div>"); But really I want to simply return the actual file, and also do it synchronously, so there's no issues with waits, deferred objects etc. How to do that? I now use

【翻译】Dockerfile参考

限于喜欢 提交于 2019-12-03 11:26:15
Dockerfile参考 来自docker官方网址: https://docs.docker.com/engine/reference/builder/ docker能够从Dockerfile中读取指令并自动构建一个镜像。 Dockerfile是一个文本文档,它包含用户可以在命令行上调用的所有命令来组装一个镜像。 使用docker构建,用户可以创建一个连续执行多个命令行指令的自动化构建。 这个页面描述了你可以在Dockerfile中使用的命令。 读完此页后,请参阅Dockerfile最佳实践( Dockerfile Best Practices )以获得面向tip的指南。 前言 翻译这篇文章前我们先阐述一个重要的概念,那就是上下文(context):docker构建时会将上下文的所有内容(.dockerignore中指定的内容除外)发送到daemon中进行处理。那么如何指定这个上下文呢?我们看一个命令来更容易的理解: docker build -t xxxxx . 注意这行命令后面有一个.(小点),这个小点的作用不是指定dockerfile的位置,指定dockerfile的位置是用-f参数来指定的,那你以为这个小点是干嘛的? 他就是用来指定构建镜像的上下文的。 理解了以上的例子后,我们再看看COPY这个命令的真是含义: COPY ./package.json /app/

compile directive inside directive AngularJS

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to use a HighlightJS directive on <pre> blocks rendered by a Markdown directive. Here is an plunker recreating the problem: http://plnkr.co/edit/qZlMkjNZglV453caNphy?p=preview In this example: <btf-markdown> #Markdown directive <pre hljs > angular.forEach($scope.items,function(item){ console.log(item); }); </pre> </btf-markdown> I would expect the <pre> block to get parsed by hljs but does not. Do I have to manually invoke the compilation of the inner directive? 回答1: Within btford.markdown your element.html(html); is

angular input formatter/parser directive and interpolated attributes?

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am attempting to write a configurable directive that is applied to an input element, which requires ngModel, and which adds a parser and a formatter function for ngModel. The problem I'm having is that I can't seem to pass interpolated values into the directive while simultaneously supporting ngModel binding. For instance, I want to be able to use my directive in one of two ways: passing literal arguments: <input ng-model="foo" my-directive="120" /> or passing interpolated arguments from the current scope: <input ng-model="foo" my

angular2 access ngModel variable from a directive

ぃ、小莉子 提交于 2019-12-03 09:25:08
问题 I am trying to build a datetime picker directive like the following. <input [(ngModel)]="date1" datetime-picker date-only /> and date1 is assigned as a Date, e.g., new Date() When I display this in html, text in input element looks like the following Thu Jan 01 2015 00:00:00 GMT-0500 I want to display like the following instead 2015-01-01 00:00:00 I want to format date WITHIN a directive using DatePipe instead of showing result from default toString() function. My question is; "within a