草庐IT

template-name

全部标签

javascript - this.name 在 javascript 中返回 undefined

我正在尝试远程创建一个onclick对于每个(以节省打字时间)。这是window.onload()功能:window.onload=function(){divel=document.getElementsByTagName('div');for(varelindivel){divel[el].onmouseover=function(){this.style.textDecoration="underline";};divel[el].onmouseout=function(){this.style.textDecoration="none";};divel[el].onclick=

javascript - AngularJs 指令 : call method from parent scope within template

我对Angular指令还很陌生,我很难让它做我想做的事。这是我所拥有的基础知识:Controller:controller('profileCtrl',function($scope){$scope.editing={'section1':false,'section2':false}$scope.updateProfile=function(){};$scope.cancelProfile=function(){};});指令:directive('editButton',function(){return{restrict:'E',templateUrl:'editbutton.t

javascript - `ng-template` 未找到内联 `ng-include`

我有一个View正在加载一个嵌入的text/ng-template,文件后面的ng-include找不到它。脚本block位于View文件的最顶部:稍后我将在文件中加载:但在控制台中产生404错误:GEThttp://localhost/~me/stringCondition404(NotFound)我已经尝试了几种命名变体(比如以.html结尾)并使用ng-include作为属性而不是高级元素。一切都没有运气。是什么导致嵌入的ng-template无法在同一View文件中注册ng-include?更新:正如评论和答案所指出的,我的代码的基本设计是正确的。但是某些原因导致ng-temp

javascript - 无法直接在 ng-template 中访问范围变量

所以我最近将一些重复的标记移到了ng-templateblock中,我注意到在block内部,我无法直接访问作用域变量,但我仍然可以调用作用域函数。例如,考虑以下标记:IToggletheFlagIDoNothingTheflagis{{flag}}与以下脚本配对:varapp=angular.module('myApp',[]).controller("myController",['$scope',function($scope){$scope.flag=true;$scope.toggleFlag=function(){$scope.flag=!$scope.flag;}}])此

javascript - [Vue 警告] : Error in render function: "TypeError: Cannot read property ' first_name' of null"

我有以下Navigation.vue组件:{{user.first_name}}import{mapActions,mapGetters}from'vuex'exportdefault{name:'hello',methods:{...mapActions(['myAccount'])},mounted:function(){if(localStorage.getItem('access_token')){this.myAccount()}},computed:{...mapGetters(['user'])}}此代码返回:[Vuewarn]:Errorinrenderfunction

javascript - AngularJS - 使用 Angular-UI Typeahead 时为 "Error: Template must have exactly one root element"

我正在使用AngularUITypeahead,在我的应用程序的“索引”页面上。我没有做任何花哨的事情-事实上,我只是想让他们在他们的UI网站上运行的示例正常工作,但我收到了这个错误:Error:Templatemusthaveexactlyonerootelement我不知道这是什么意思,但只有当我有以下代码时才会发生:如果相关,我的主页Controller(通过$routeProvider为/索引目录调用):functionindexCtrl($scope,$location,$resource){$scope.selected=undefined;$scope.states=['

javascript - 是否可以实现 'Continue as {Facebook user name}' 按钮?

我正在尝试为我的站点实现Facebook登录按钮。一些Facebook产品有一个很好的FB按钮,它使用已经登录的用户的Facebook用户名。还有一个问题:当用户已经在浏览器中登录时,是否可以使用Javascript获取FB名称?例子: 最佳答案 您可以在Facebook文档中找到它,登录按钮/插件配置器部分:https://developers.facebook.com/docs/facebook-login/web/login-button有一个选项:当用户登录Facebook时包括姓名和头像

javascript - Angular JS 错误 : $compile:tpload: Failed to load template:

所以我试图在我的指令中加载模板。该指令是可重用的。但是我无法加载模板。我有其他模板可以加载并正常工作。我得到的错误是:GET/ClassificationToolkitForGrails/classificationviewer.html404(NotFound)angular.js:8521Error:[$compile:tpload]Failedtoloadtemplate:classificationviewer.html包含指令的javascript文件:/****/varclassificationViewModule=angular.module('ald.classifi

javascript - typescript 错误 : Reserved word 'this' used as name

我正在尝试获取thisNode.jsTypeScript定义可以正常工作,但WebStorm给了我一大堆错误,其中包含所有相同的消息:Reservedword'this'usedasname.ThisinspectionreportsonanyusesofJavaScriptreservedwordsbeingusedasaname.TheJavaScriptspecificationreservesanumberofwordswhicharecurrentlynotusedasJavaScriptkeywords.Usingthosewordsasidentifiersmayresu

javascript - Meteor Blaze 访问 Template.onCreated 中的 Template.contentBlock

我正在为child编写自定义Blazeblock助手:{{>Template.contentBlock..}}{{>Template.contentBlock..}}我的预期用例是拥有一个包含我在html文件中定义的任意子节点的模板。{{#parent}}{{#childid="child1"title="Child1"}}Thisiscontentofchild1{{/child}}{{#childid="child2"title="Child2"}}Thisiscontentofchild2{{/child}}{{#childid="childN"title="ChildN"}}T