class Header { constructor($scope){ 'ngInject'; $scope.isshow = false; } } export default class header { constructor() { this.restrict = 'E', this.scope = {}, this.template = require(./header.html) this.controller = Header this.link = (scope, element, attr) => {} } }
header/header.html
<div> <a href="#home" >home</a> <a href="#router" >router</a> </div>
4.home
home/index.js
import angular from "angular"; import HomeController from './controller'; export default angular.module('app_home',[]) .controller('HomeController', HomeController)
home/controller.js
export default class HomeController { constructor($scope) { 'ngInject'; this.isshow = false; this.eage = 'sds'; $scope.edg = 'sma' } change(){ this.isshow = !this.isshow; console.log(this.isshow); } }
home/home.html
<div>home {{HMC.eage}} -- {{edg}}</div>
其余的模块大同小异就不依依去写了。