ngRepeat div get commented out when i see from the browser inspector

狂风中的少年 提交于 2019-12-14 03:37:55

问题


this is my html code.but the ngRepeat div show as commented in browser inspector

enter image description here

<

html ng-app="myApp">
<head>
<link rel="stylesheet" href="script/bootstrap.css">
<script src="script/tuto.js"></script>
<script type="text/javascript" src="script/angular.js"></script>
<script type="text/javascript" src="script/angular.min.js"></script>
<script type="text/javascript" src="script/bootstrap.js"></script>
<script type="text/javascript" src="script/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/app.css">


<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>
</head>
<body style="padding: 50px"  ng-controller="ctrl">

    <div>



        <p>
            <input type="text" placeholder="Search..." ng-model="searchFor"
                size="20" />
        </p>


        <div class="album panel panel-primary" ng-repeat="album in albums">
            <div class="panel-heading">
                {{ album.title }}
                <div style="float: right">{{ album.date }}</div>
            </div>
            <div class="description">{{ album.description }}</div>
        </div>
    </div>

        <p>
            <input type="text" placeholder="Search..." ng-model="searchFor"
                size="20" />
        </p>


        <div class="album panel panel-primary" ng-repeat="album in albums">
            <div class="panel-heading">
                {{ album.title }}
                <div style="float: right">{{ album.date }}</div>
            </div>
            <div class="description">{{ album.description }}</div>
        </div>



        <h3>Add new Album</h3>

        <div class="album panel panel-success" ng-repeat="album in albums">
            <div class="panel-heading">
                {{ album.title }}
                <div style="float: right">{{ album.date }}</div>
            </div>
            <div class="description">{{ album.description }}</div>
        </div>





</body>
</html>

enter code here

This is the HTML code.it's also have the script part for angularJs.but the ngRepaet div showed as commented in browser inspector


回答1:


You should write script in another file and add ng-app Here is plnkr https://plnkr.co/edit/yvJGX52osH9eTJggexec?p=preview

your problem is you include file script above angular.js . include below and problem will solved

    <link rel="stylesheet" href="script/bootstrap.css"> 
<script> type="text/javascript" src="script/angular.js"></script> 
<script> type="text/javascript" src="script/angular.min.js"></script> <script> type="text/javascript" src="script/bootstrap.js"></script>
 <script type="text/javascript" src="script/bootstrap.min.js"></script> 
<link rel="stylesheet" href="css/app.css">
 <script src="script/tuto.js"></script> //include below



回答2:


@Thanh check this..this is the file



来源:https://stackoverflow.com/questions/43739301/ngrepeat-div-get-commented-out-when-i-see-from-the-browser-inspector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!