modal-controller.js 686 B

1234567891011121314151617181920212223242526
  1. import App from '../../../base'
  2. import { react2angular } from 'react2angular'
  3. import DictionaryModal from '../components/dictionary-modal'
  4. import { rootContext } from '../../../shared/context/root-context'
  5. export default App.controller('DictionaryModalController', function ($scope) {
  6. $scope.show = false
  7. $scope.handleHide = () => {
  8. $scope.$applyAsync(() => {
  9. $scope.show = false
  10. window.dispatchEvent(new CustomEvent('learnedWords:reset'))
  11. })
  12. }
  13. $scope.openModal = () => {
  14. $scope.$applyAsync(() => {
  15. $scope.show = true
  16. })
  17. }
  18. })
  19. App.component(
  20. 'dictionaryModal',
  21. react2angular(rootContext.use(DictionaryModal), ['show', 'handleHide'])
  22. )