草庐IT

基本指令

全部标签

c# - 找不到类型或命名空间(是否缺少 using 指令或程序集引用?)

当我尝试编译我的C#程序时出现以下错误:找不到类型或命名空间名称“Login”(是否缺少using指令或程序集引用?)usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceFootballLeague{publicpartialclassMainMenu:Form{FootballLeagu

C# - 基本问题 : What is '?' ?

这个问题在这里已经有了答案:Whatdoes"DateTime?"meaninC#?(7个答案)关闭9年前。我想知道?在C#中是什么意思?我看到类似这样的内容:DateTime?或int?。我想这是C#4.0特有的?我无法在谷歌中找到它,因为我不知道这个东西的名字。问题是我正在使用DateTime并且我有很多转换错误(从DateTime到DateTime?)。谢谢

c# - 为什么编译器在从方法返回字符串时会创建一条似乎什么都不做的指令?

我正在查看为一个非常简单的方法生成的IL,因为我想自己做一些反射,我遇到了这个问题的评论中提到的一些东西(但不是问题):UsingBr_SOpCodetopointtonextinstructionusingReflection.Emit.Label没有人回答,我对此感到疑惑。所以...如果我有这样的方法:publicstringTest(){return"hello";}然后我在上面运行ILDASM我看到IL是这样的:.methodpublichidebysiginstancestringTest()cilmanaged{//Codesize11(0xb).maxstack1.loc

javascript - 自定义指令链接中的 element.replaceWith 仅在第一次调用时有效

我是Angularjs的新手,对幕后的了解不多。基本上我想创建一个“E”扭结指令,基于Controller中的数据我动态创建html,就像整个“表”一样,以替换指令。我的html文件中的directve是这样的:我的指令代码是这样的:angular.module('matrix',[.....]).directive('matrixrows',[...,function(...){return{restrict:'E',replace:true,require:'^matrix',link:function(scope,element,attr,ctrl){.........scope

javascript - 将值从指令传递到 Controller

下面是我的html模板:下面是我的代码:varapp=angular.module('dr',[]);app.controller("testCtrl",function($scope){$scope.ctrlFn=function(arg){alert(arg);}});app.directive('test',function(){return{restrict:'E',scope:{fromDirectiveFn:'&method'},link:function(scope,elm,attrs){//WayOnescope.hello="somemessage";scope.fr

javascript - 创建[下载]按钮的指令

我得到帮助在客户端将json保存为文件here.在这个fiddle中,代码非常短。vara=document.createElement('a');a.download="backup.json";a.href=url;a.textContent="Downloadbackup.json";document.getElementById('content').appendChild(a);我试图创建一个angularjs指令,以便它调用范围内的方法来获取数据。沿着这条线。module.directive('myDownload',function($compile){return{re

javascript - 在 TypeScript 中扩展基本类型,错误 : "_this is not defined..."

我正在尝试用TypeScript重写我的一些JavaScript代码。其中一些代码引用了我添加到字符串对象原型(prototype)的扩展。String.prototype.format=function(){varformatted=this;for(vari=0;i然而,使用类型脚本添加这个非常具有挑战性。我见过这样的例子,您声明一个基本接口(interface)的扩展,然后将一个函数分配给原型(prototype)以匹配该接口(interface)并提供您的功能。像这样...interfaceString{showString:()=>string;}String.prototy

javascript - AngularJS 指令不起作用

我在我的一个项目中使用AngularJS,我想尝试创建指令。我已经学习了几个教程,但看不出哪里做错了。更糟糕的是,它不会显示任何错误或警告消息,但它也不会执行指令的功能。现在,我的代码几乎是这样的:angular.module('components',[]).directive('ngxOnshow',function(){return{restrict:'A',link:function(scope,element,attrs){console.log("helloworld")//Restodocódigodafunção}};});varmodule=angular.modul

javascript - Angularjs 将变量传递给具有继承(非隔离)范围的指令

如果我使用的是独立作用域,我可以通过属性传递变量。即然后,在指令的Javascript上.directive('myDirective',function(){return{scope:{'baz':'='}}});有什么方法可以对继承范围做类似的事情吗?链接函数只是传递字符串。现在我正在自己解析变量并将其与scope.$parent匹配。似乎应该有一个辅助函数或更简单的方法来做到这一点。 最佳答案 使用$eval或$parse:.directive('myDirective',function($parse){return{sco

javascript - 如何使用 angular-google-maps <markers> 指令?

我在myproject中使用angular-google-maps|.我正在尝试使用以下定义的对象添加多个标记:vehicles=[{stuff:"stuff",last_known_location:{latitude:number,longitude:number}},{stuff:"stuff",last_known_location:{latitude:number,longitude:number}},//...etc]我的指令是这样的:Vehicles是如上所述的对象数组。这行不通。如果我将我的模型更改为仅具有纬度和经度属性并完全丢失last_known_location属