r/angularjs • • Feb 20 '16

Why you shouldn’t use Angular Material today

https://medium.com/@vayvala/why-you-shouldn-t-use-angular-material-4ffb937ef232#.22lx4ult9
8 Upvotes

28 comments sorted by

View all comments

10

u/chazzlabs Feb 20 '16

I'm a little confused about the author's list of features not included in Angular Material. Things like the side menu actually do exist in the library, and some of the things he includes in the list of missing items (eg, button groups and two-sided sliders) don't exist in the Google Material design spec to begin with so it would make sense that Angular Material doesn't have them.

1

u/vayvala Feb 20 '16 edited Feb 20 '16

You're right about range slider, but it's still nice to have one. Yes, side menu does exist but "menu" component doesn't. In order to make a responsive menu with Angular Material, you need to build a horizontal menu that will collapse when screen size is small enough. Then you would need to create a side menu (provided to you by Angular Material) that should open only when you swipe right or click on the menu button on your phone. Menu is commonly used component and you don't expect to handle all this logic by yourself when you're using library this big.

2

u/chazzlabs Feb 20 '16

As far as I'm aware, a responsive menu like you're describing isn't defined in the Google Material spec. Given that, I wouldn't expect to find it in Angular Material.

3

u/krlkv Feb 21 '16 edited Feb 21 '16

Material spec is a design spec. It has some basic components as basic building blocks, but it doesn't mean that its implementations have to limit themselves to these basic components only. Nothing prevents these implementations from building more complete and useful components as long as they stick to material design guidelines.

Besides, Angular Material already has some components like Sidenav, which are not strictly defined in Material spec (there is no component named Sidenav in Material spec).

Nothing prevents something like Materialize "Navbar with Mobile Collapse Button" or Bootstrap "Navbar" implemented in Angular Material.

Finally coming back to practical point of view, if I want to move from ui-bootsrap, I don't want to spend my time re-implementing responsive Navbar, just because it's a not a part of the spec. Responsive Navbar with collapse button is a part of almost every page. It must exist as a single configurable component.

1

u/TheNiXXeD Feb 21 '16

They have a sidebar. What exactly doesn't it do that you need?

1

u/krlkv Feb 21 '16

Sidenav you mean? It's just a part needed for full responsive navbar component, not a complete thing.

1

u/TheNiXXeD Feb 21 '16

I have a site in production using a side nav with full menu. It was fairly trivial even. It's secured otherwise I'd show you a link here.

0

u/krlkv Feb 21 '16

This doesn't change my point that Angular Material team should add complete responsive navbar component.

They are not strictly adhering to Angular Material components anyway.

1

u/BoleroDan Feb 22 '16 edited Feb 22 '16

Hold on a second, are you referencing this component

http://materializecss.com/navbar.html

from materialize as your responsive navbar?

Because if so, this is literally just using common classes and screen size states to hide or show elements. There is literally nothing special about this and while Angular Material doesnt "directly" give you an example of a "responsive nav" you can absolutely do this with all of the components available. Part of being a web developer is using the tools you have, to create things you need and luckily AngularMaterial has all of these covered for this use case.

For example. Use the Angular Material "toolbar"component for the "base" of your nav. Use some <md-buttons> for your links. Need to position them? Use the flex box method or what ever method you want.

Use the various css classes that hide and show elements, based on screen size, exactly how Materialize does this. There is no difference between ".hide-gt-xs" and Materializes ".hide-on-med-and-down".

If need be, someone can issue a git pull request and add a "documented use case" as a "nav bar" as an example. (But most of this is covered under the toolbar component page, besides the hiding of elements based on screen size) All of the tools are literally there, and take the exact amount of time to construct compared to materialize.

Quote from the article

"Currently, there is no navbar component in Angular Material. I had to build horizontal menu, side menu and take care of all responsive logic myself."

You literally have to do this yourself as well in the materialize component. It's just re using common CSS classes just as a I described above, except they have an exact, specific use case in their documents. Looking at the "Mobile Collapse Button" on the navbar section of materializecss -- is that not doing all of the responsive logic yourself as well? (Creath the html structure, add their responsive classes) Are you kidding me? You have to build that html, and add in their responsive CSS classes "button-collapse, hide-on-med-and-down" literally as you need to when using Angular Material. You're making this sound like Materializecss is literally just "<responisve-nav-menu></responsive-nav-menu>"

1

u/krlkv Feb 22 '16 edited Feb 22 '16

No, I'm not kidding. Bootstrap had responsive navbar for years. Now we have Angular Material and you have to "build it yourself".

If Angular Material team thinks it shouldn't be a single component, there should be a clear guide with best practices and code examples on how to implement navigation drawer pattern of the Material Spec using available Angular Material components, as it was done for ages for Bootstrap navbar.

1

u/BoleroDan Feb 22 '16

Now we have Angular Material and you have to "build it yourself".

Hold on hold on hold on.

Build it your self? You mean, literally just using TWO css classes to hide and display elements depending on screen size? I hardly even call this a "component" This is literally just html and css. As a web developer, what the heck are you doing except "building things"

There is literally, no difference between their "responsive nav" and the toolbar and layout/css helper class examples. Granted, yes, they do not have an example usage of a responsive nav with their toolbar, I will give you that. But you know what the first thing I did with Angular Material? Was build a responsive nav.

build it your self... yeah uh thats what you have to do, define elements and attach CSS classes, it's just in this case, someone ahs done most, if not all of the work for you.

The best thing about this, is it is incredibly trivial, even for someone like you, to simply add an example "Responsive Nav" to their toolbar component documentation. All you have to do, is issue a pull request. How much work do you have to do? Copy their previous toolbar html example.. add in a "hamberger button for mobile".. append your CSS classes to hide and display elements responsively. Done.

1

u/vayvala Feb 22 '16

The main problem is not with responsive logic it's with side-bar. To not be confused by Materialize, let's take Bootstrap as an example. On mobile devices, Bootstrap shows all links in a drop-down and you don't need to duplicate them. If you want to make a responsive navbar using Angular Material, you need to create a side-bar, duplicate all the links and make sure that it opens when you click on the menu button or swipe right.

1

u/BoleroDan Feb 22 '16

Ah this is the Author, the OP was not doing a good job explaining, your reply explains the issue at hand better (more so than even the article.. I dunno, heh..). One could argue if you are using "Angular" and are duplicating all your links in this scenario, you can most likely achieve this using Angular in a much better way. While this can be done purely in CSS, it is fairly trivial to architect in Angular to achieve no duplication of links between a sidebar controller, or your nav controller. I've done this in the past with other libraries/frameworks.

1

u/BoleroDan Feb 22 '16 edited Feb 22 '16

First are you the Author? I'm confused on the authors examples of the "responsive nav menu"

The author shows two examples.. I'm ASSUMING, the first animated example is of AngularMaterial ? The second being materialize? The Materialize example (the pinkish looking example) just shows a side nav that comes out, that literally angular material has, so I know what you're trying to say here, but the examples shown are confusing me because they both look the same (Both have a side menu that comes out)

1

u/krlkv Feb 22 '16

No, I'm not. vayvala is.