javascript-在Angularjs中多次使用ngInclude
作者:互联网
我有这个小脚本,Angular的控制器完全空了,所以那里什么也没有.
我的问题是为什么我不能运行ngIncludes(顺便说一句没有错误)?
<!DOCTYPE html>
<html ng-app="demo">
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<meta name="msapplication-tap-highlight" content="no" />
<script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/angularjs/angular.min.js"></script>
</head>
<body>
<div ng-controller="main">
<ng-include src="'templates/android/header.html'" />
<ng-include src="'templates/android/newsfeed.html'" />
</div>
解决方法:
我遇到了同样的问题,但就我而言,我没有正确关闭div标签:
<div ng-include="'partials/agendar.html'">
<div ng-include="'partials/atendimento.html'">
正如我看到的那样,但是您正在使用’ng-include’作为标记.像这样尝试(对我来说效果很好).确保您的角度已更新,然后仅使用“ ng-include”(不使用“ data-”):
<div ng-include="'partials/agendar.html'"></div>
<div ng-include="'partials/atendimento.html'"></div>
希望能帮助到你.
标签:angularjs-ng-include,angularjs,javascript 来源: https://codeday.me/bug/20191121/2051441.html