Answer the question
In order to leave comments, you need to log in
Why doesn't ng-view render the html template?
Not to say that for a long time, but probably for a month and a half I have been interested in angular.js. It seems like some kind of understanding appeared, so I decided that it would not be bad to try to write something to consolidate.
Faced a very banal thing. And I don't know how to get out of it.
There is a node.js server that returns:
app.get('/', function(req, res){
res.sendfile(path.join(staticPath, 'index.html'));
});
<!DOCTYPE html>
<html>
<head>
<title>App</title>
</head>
<body ng-app="app">
<div>
<div ng-view></div>
</div>
<script type="text/javascript" src="lib/angular.js"></script>
<script type="text/javascript" src="lib/angular-route.js"></script>
<script type="text/javascript" src="lib/angular-websocket.js"></script>
<script type="text/javascript" src="lib/snap.svg-min.js"></script>
<link rel="stylesheet" type="text/css" href="lib/stylesheet.css">
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="menu/index.js"></script>
</body>
</html>
angular.module('app',[
'ngRoute',
'ngWebSocket'
])
.config(function ($routeProvider, $locationProvider){
$routeProvider.when('/',{
templateUrl: 'menu/menu.html',
controller: 'MenuController'
});
$routeProvider.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
});
console.log('Menu Controller');
<div>
<div>
<p>Some text string</p>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question