没有在角度js中输出输出 [英] Not geting output in angular js
本文介绍了没有在角度js中输出输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的视图中显示模型,但我不想放置?亲切的帮助
我的尝试:
// /< reference path =scripts / angular.min.js/>
var app = angular.module( my,[])。controller( co , function ($ scope){
var emp = [
{firstname: ben,seconedname: gupta},
{firstname: Vikrant,seconedname: gupta}
];
$ scope.emp = emp;
});
< !DOCTYPE html >
< html >
< head >
< script src = scripts / angular.min.js > < / script >
< script src = scripts / userdefine.js > < / script >
< title > < / title >
< / head >
< < span class =code-leadattribute> body < span class =code-attribute> ng-app = >
< div ng-controller = co > ;
< table >
< thead >
< tr >
< th >
名字
< / th >
< th >
Seconed name
< / th >
< / tr >
< span class =code-keyword>< / thead >
< tbody >
< tr ng-repeat = emp1 in emp >
< td >
{{emp1.firstname}}
< / td >
< td >
{{emp1.firstname}}
< / td >
< 跨度> <跨度class =code-leadattribute> / tr >
< / tbody >
< / table >
< / div >
< / body >
< / html >
解决方案
范围){
var emp = [
{firstname: ben,seconedname: <跨度class =code-string> gupta},
{firstname: Vikrant ,seconedname: gupta}
];
scope.emp = emp;
});
< !DOCTYPE html >
< ; html >
< head >
< script src = scripts / angular.min.js > ; < / script >
< script src = scripts / userdefine.js > < / script >
< title > < / title >
< < span class =code-leadattribute> / head >
< body ng-app = < span class =code-keyword> >
< div ng-controller = co >
< table >
< thead >
< tr >
< t h >
名字
< / th >
< < span class =code-leadattribute> th >
Seconed name
< / th >
< / tr >
< / thead >
< tbody >
< tr ng-repeat = emp1 in emp >
< td >
{{emp1.firstname}}
< / td >
< td >
{{emp1.firstname}}
< / td >
< 跨度>/ tr>
< / tbody >
< / table >
< ; / div >
< / body >
< / html >
你需要改变一件事,它会像魔法一样工作。
你必须在 ng的视图中指定模块名称 -app 属性。
< body ng-app =my>
I am trying to display model in my view but i am not geting out put? kindly help
What I have tried:
/// <reference path="scripts/angular.min.js" />
var app = angular.module("my", []).controller("co", function ($scope) {
var emp = [
{ firstname: "ben", seconedname: "gupta" },
{ firstname:"Vikrant",seconedname:"gupta" }
];
$scope.emp = emp;
});
<!DOCTYPE html>
<html>
<head>
<script src="scripts/angular.min.js"></script>
<script src="scripts/userdefine.js"></script>
<title></title>
</head>
<body ng-app = "">
<div ng-controller ="co">
<table>
<thead>
<tr>
<th>
First name
</th>
<th>
Seconed name
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat ="emp1 in emp">
<td>
{{emp1.firstname}}
</td>
<td>
{{emp1.firstname}}
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
解决方案
scope) { var emp = [ { firstname: "ben", seconedname: "gupta" }, { firstname:"Vikrant",seconedname:"gupta" } ];
scope.emp = emp; });
<!DOCTYPE html> <html> <head> <script src="scripts/angular.min.js"></script> <script src="scripts/userdefine.js"></script> <title></title> </head> <body ng-app = ""> <div ng-controller ="co"> <table> <thead> <tr> <th> First name </th> <th> Seconed name </th> </tr> </thead> <tbody> <tr ng-repeat ="emp1 in emp"> <td> {{emp1.firstname}} </td> <td> {{emp1.firstname}} </td> </tr> </tbody> </table> </div> </body> </html>
You need to change one thing and it will work like magic.
You must specify module name in the view in ng-app attribute.
<body ng-app = "my">
这篇关于没有在角度js中输出输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文