javascript - AngularJs application not working in chrome but working in other browsers -
i trying simple application not supported in google chrome browser. trying call html within html page. using ng-include directive. code working in other browsers firefox. here code: test.html
<!doctype html> <html> <head> <script src="angular.min.js"></script> <script src="newscript.js"></script> <link href="styles.css" rel="stylesheet" /> </head> <body ng-app="mymodule"> <div ng-controller="mycontroller"> <div ng-include="'etable.html'"></div> </div> </body> </html>
etable.html
<table> <thead> <tr> <th>name</th> <th>gender</th> <th>salary</th> </tr> </thead> <tbody> <tr ng-repeat="employee in employees"> <td> {{employee.name}} </td> <td> {{employee.gender}} </td> <td> {{employee.salary}} </td> </tr> </tbody> </table>
newscript.js
var app = angular .module("mymodule",[]) .controller("mycontroller", function ($scope) { var employees = [ { name: "ben", gender:"male", salary:5000 }, { name: "ten", gender:"female", salary:4000 }, { name: "zen", gender:"male", salary:3000 }, { name: "aen", gender:"female", salary:7000 } ]; $scope.employees = employees; });
you need run application on server. if using npm install npm install http-server
, start server in project folder following command http-server
.
, start application on localhost
.
Comments
Post a Comment