AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template
.controller('HomeController', function($scope,$location) {
$scope.userName='天下大势,为我所控!';
$scope.clkUrl=function(){
$scope.pageUrl='norout1.html';//更改值
}
$scope.clk2=function(){
alert($scope.userName);
$scope.userName='司马懿'
}
}).directive('bhtml',function(){
return {
templateUrl:'norout1.html',
restrict:'E',replace:true
}
})
<div ng-controller="HomeController as homeP"> <p>下面是指令载入文件:<bhtml></bhtml></p> </div> norout1.html: <p> <pre> 这里是:没有使用路由载入 <button ng-click="clk2()" >看是否能访问到数据</button> <input type="text" ng-model="userName"/> </pre> </p>
replace:true导致AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template
删除或设置为false。
AngularJS: 'Template for directive must have exactly one root element' when using 'th' tag in directive template的更多相关文章
- Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value '"*, Microsoft.AspNet.Mvc.TagHelpers"'
project.json 配置: { "version": "1.0.0-*", "compilationOptions": { " ...
- VS2015突然报错————Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with ...
- VUE之命令行报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead 解决办法
Failed to compile. ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-5992 ...
- VUE编译报错 Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead
背景: 在使用VUE添加标签的时候编译报错,报错如下: Component template should contain exactly one root element. If you are u ...
- vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one roo ...
- 组件嵌套时报:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
在组件嵌套的过程中,报了一个错误: 这里报错的原因是:vue的组件(模板)只能有一个根节点,即.vue文件中的<template>标签下只能有一个子元素. 因此,建议大家在写.vue组件的 ...
- Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
运行代码时,一直报错: 经过查询后才知道,vue模板只能有一个跟对象 我是这样写的 最后修改为 就可以正常运行了
- vue父子组件嵌套的时候遇到 - Component template should contain exactly one root element. If you are using v-i
转自:https://blog.csdn.net/yangyiboshigou/article/details/72084619
- 【错误总结】Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
大致意思是因为模板里面应该包含一个根元素,使用组件的时候应该用div或p标签包起来
随机推荐
- JQuery兼容IE6问题汇总(不断更新)
兼容IE6真是苦逼的差事,无奈中... 逗号的问题:IE6中要去掉最后的逗号 var o={ id:1, Name:"abc", //这里的逗号一定要去掉 } HTML的结构,由于 ...
- 定时往oracle插入数据
1创建存储过程 create or replace procedure job_proc isbegininsert into yy (yid) values (sysdate);end; 2创建jo ...
- CentOS 升级PHP
wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm wget http://rpm ...
- little alchemy攻略
一个造物游戏: acidrain=rain+smoke airlplain=metal+bird alcohol=fruit+time algae=plant+water allergy=dust+h ...
- 《zw版·Halcon-delphi系列原创教程》 酸奶自动分类脚本(机器学习、人工智能)
<zw版·Halcon-delphi系列原创教程>酸奶自动分类脚本(机器学习.人工智能) Halcon强大的图像处理能力,令人往往会忽视其内核,是更加彪悍的机器学习.人工智能. ...
- 关于css的一些知识点整理
一.标签的类型: 行内:span.a.b.i.strong.em. 1.共处一行 2.不支持设置宽高 display:block; 转换成块 块:h1-h6 p div ul ol 1. ...
- PetaPoco入门(二)
1. Petapoco基本用法 1.1. 创建示例工程 首先创建一个工程文件,为了便于展示数据这里创建一个类型为:WindowsApplication的工程文件.命名为:PetapocoTest. 程 ...
- 【UML】如何记忆UML类图的画法
前言 UML类图形象反映系统类之间的关系,大家非常常用.小弟不才,偶尔使用,往往每次使用都得查询各种关系的表示方式.终于,这次认真看了几遍,打算记起来. 注意 记忆方法只是本人联想,用于加强记忆.与该 ...
- iOS常用第三方
名称 作用 说明 AFNetworking 基于HTTP协议联网 SDWebImage 图片缓存和异步加载 YYWebImage 图片缓存和异步加载 Ono XML解析 Rapture ...
- Cheatsheet: 2015 06.01 ~ 06.30
Web The Front-End Optimization Checklist [ASP.NET 5] Production Ready Web Server on Linux. Kestrel + ...