Can I use Ionic Material with Ionic 2? - ionic2

I am going to develop an IOS application using Ionic 2 , Is there any ability to use Ionic Material IonicMaterial
to materialize my app ?
I know that Ionic 2 is already materialized but I want to make benefit of Ionic material library.

Yes .You can use.
install angular material
1.
npm install --save #angular/material
2.import and add
import { MaterialModule } from '#angular/material';
// other imports
#NgModule({
imports: [MaterialModule],
...
})
then you can use material components

Related

Can I add Daisy UI plugin to my django project? If yes , Please how do I do it?

I have already installed tailwind CSS to my django project and it works just fine,
I tried using the documentation procedure I saw at the daisyui website
npm i daisyui
and I also added the plugin to my tailwin.config.js file also
module.exports = { //... plugins: [require("daisyui")], }

Ember addon: Could not find module from within component

In a new ember 3.28 addon project:
npm install chart.js --save
ember g component-class chart
Insert <Chart /> into application.hbs on dummy app and in addons/component/chart.js, add this
import Chart from 'chart.js/auto';
Running app gives:
Uncaught Error: Could not find module `chart.js/auto` imported from `chartjs-test/components/chart`
Yet if the import Chart goes into the application.js route in the dummy app instead, it works. How can you import this module correctly from within an addon component?
Update: Same issue with other installed packages eg. import chroma from "chroma";
Turns out you need to add the same import statement into app/component/chart.js:
UPDATE:
The above isn't the proper way and causes issues when using the addon elsewhere. The real solution is to move ember-auto-import to dependencies from devDependencies in package.json of the addon

Ionic 2 CamScanner Plugin

i want to use cordova-camscanner in my ionic 2 project. But i cant import the Plugin. cordova-camscanner
I install it with:
cordova plugin add cordova-camscanner --variable ANDROID_APP_KEY=YOUR_APP_KEY
I see the Plugin in my list with:
ionic plugin list
But when i want to import ist with:
import {CordovaCamscanner} from 'ionic-native';
ionic says:
node_modules/ionic-native/dist/es5/index"' has no exported member 'CordovaCamscanner'
whats wrong?
If you look at Ionic Native's documentation, you can see that the CamScanner plugin is not part of it (not in the list on the left side).
So
import {CordovaCamscanner} from 'ionic-native';
is not supposed to work, because as the displayed error says, it is not an exported member of the Ionic Native module.

ionic2 rc0 where to put all sass files?

In Ionic Beta 2 we have decentralized our sass/scss files to our components.
Now in RC0 the upgrade guide by Ionic team is not their finest work, unfortunately.
This is how my app.scss looks like, it imports all our decentralised sass file:
#import '../+user/user-list/user-list.component';
Now imaging above 100 fold. What do I do to upgrade to RC0?
Turns out imports work like before. Against Ionic RC0 Upgrade Documentation there is no need to change any of your imports inside your app.scss. All good.
#import '../+user/user-list/user-list.component';
Works.
You need not import your scss files in ionic RC0. All you need is to create an scss file with the name you use in .ts selector.
Eg:
#Component({
selector: 'registration',
templateUrl: 'registration.html'
})
In this case i have to create registration.scss for scss. Refer 36th point under Modifying your Existing Project in https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#tab-inputconfig-7143

How do we import stompjs in a browser? Or something like stompjs?

I am trying to follow this Spring tutorial on how to use websockets. I am using webpack to bundle my code and babel to convert it from ES6. I am trying to pull in sockjs with a normal import statement.
import SockJS from 'sockjs'
But when webpack runs, I get missing module errors,
ERROR in ./~/stompjs/lib/stomp-node.js
Module not found: Error: Cannot resolve module 'net' in /Users/name/Developer/cubs-stack-4/cubs-webapp/node_modules/stompjs/lib
# ./~/stompjs/lib/stomp-node.js 14:8-22
ERROR in ./~/websocket/package.json
Module parse failed: /Users/name/Developer/cubs-stack-4/cubs-webapp/node_modules/websocket/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "_args": [
| [
| "websocket#latest",
# ./~/websocket/lib/version.js 1:17-43
mainly because it is expecting to be run on Node.
I have 2 questions.
First, how do I get stompjs into my browser side code using an import/require statement?
Second, how come in the tutorial, they can drop stompjs in the HEAD and it doesn't blow up in the browser, but it does when I run the "same" code through webpack?
It seems that stompjs library referenced in Spring's documentation is no longer developed, but there is fork that is maintained and with instructions on how to add it to your project available here: https://github.com/stomp-js/stomp-websocket
Here are the steps that I used to resolve this issue and to get things working in a React app with websockets on Spring backend:
# Add sockjs and stompjs dependencies
npm install sockjs-client --save
npm install #stomp/stompjs --save
Then import it into your app:
import SockJS from "sockjs-client"
import Stomp from "#stomp/stompjs"
You should now be able to use the frontend code from the Spring's documentation successfully.
installing 'net' dependency solved my issue
npm i sockjs-client --save
npm i stompjs --save
npm i net
and import like this
import * as SockJS from 'sockjs-client';
import * as Stomp from 'stompjs';
You have to import "sockjs-client": "^1.0.3" in your package.json.
Then you can import it with
import SockJS from 'sockjs-client'
My webpack.config.js contains the library 'sockjs-client'.
Additionally I added the following conf, in order to ignore missing net module.
node: {
net: 'empty',
tls: 'empty',
dns: 'empty'
}
Source: https://github.com/hapijs/joi/issues/665#issuecomment-113713020
In ionic 6 Angular 12
Install
npm i --save sockjs-client stompjs net
Then
npm i --save-dev #types/sockjs-client #types.stompjs
Import using
import * as SockJS from 'sockjs-client';
import * as Stomp from 'stompjs';
To solve the issue with 'global' I had to add the following to index.html
<script type="application/javascript"> var global = window; </script>
To use stompjs in browser, just open file your_path/node_modules/stompjs/index.js, comment it like this:
var Stomp = require('./lib/stomp.js');
// var StompNode = require('./lib/stomp-node.js');
module.exports = Stomp.Stomp;
// module.exports.overTCP = StompNode.overTCP;
// module.exports.overWS = StompNode.overWS;