如何使用ng-click切换课程

时间:2018-08-21 14:41:42

标签: angularjs

我知道您可以轻松地切换这样的课程:

.c {
  padding: 20px;
  background: #00adff;
}

.a {
  background: #43dd31;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="">
  <div class="c" ng-class="{'a': toggle }">
    <button ng-click="toggle = !toggle">Toggle</button>
  </div>
</div>

我的问题是,如果我想使用这种方法在同一div上使用不同的按钮切换两个单独的类,该怎么办?

1 个答案:

答案 0 :(得分:2)

AngularJS允许您以地图格式定义许多类。以下是使用第二个按钮切换类Const sRootFolder = "C:\test" Dim oFSO, oFile ' File and Folder variables Dim xlApp, xlBook, objWorkbook Start Sub Start() Initialize ProcessFilesInFolder sRootFolder Finish End Sub Sub ProcessFilesInFolder(sFolder) ' Process the files in this folder For Each oFile In oFSO.GetFolder(sFolder).Files If IsExcelFile(oFile) Then ProcessExcelFile oFile.Path Next End Sub Sub Initialize() Set oFSO = CreateObject("Scripting.FileSystemObject") Set xlApp = CreateObject("Excel.Application") End Sub Sub Finish() xlApp.Quit Set xlBook = Nothing Set xlApp = Nothing Set oFSO = Nothing End Sub Function IsExcelFile(oFile) IsExcelFile = (InStr(1, oFSO.GetExtensionName(oFile), "xls", vbTextCompare) > 0) And (Left(oFile.Name, 1) <> "~") End Function Sub ProcessExcelFile(sFileName) Set xlBook = xlApp.Workbooks.Open(sFileName, 0, True) Set objWorkbook = xlApp.Workbooks.Open(sFileName) xlApp.Run "macro" End Sub Sub Save() xlBook.Save xlBook.Close xlApp.Quit WScript.Echo "Finished." End Sub 的演示。

b
.c {
  padding: 20px;
  background: #00adff;
}

.a {
  background: #43dd31;
}

.b {
  border: 5px dashed yellow;
}