Node.js網頁模板使用 angular
阿新 • • 發佈:2018-12-11
用bower進行各種包的安裝
不知道為啥我的埠會報錯,因為我還沒有學習angular,所以暫時的話,僅僅是程式碼掛在這裡。問題等以後在解決。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" href="components/bootstrap/dist/css/bootstrap.min.css"> </head> <body> <div ui-view="head"></div> <div ui-view="body"></div> <div ui-view="food"></div> <script src="components/angular/angular.min.js"></script> <script src="components/angular-ui-router/release/angular-ui-router.min.js"></script> <script src="components/jquery/dist/jquery.min.js"></script> <script src="js/index.js"></script> </body> </html>
var myapp = angular.module('myapp',['ui.router']); myapp.config(['$stateProvider','$urlRouterProvider', function($stateProvider,$urlRouterProvider){ $stateProvider.state('home',{ url:'/home', views:{ head:{ template:'<h1>頭部的內容</h1>' }, body:{ templateUrl:'./views/body.main.tpl.html', controller:"body.main.ctrl" }, food:{ template:'<h1>頁尾的內容</h1>' } } }) $urlRouterProvider.otherwise('/home'); }]); myapp.controller("body.main.ctrl",[])