Angular Material framework is very useful. It will make your SPA look like a native mobile app. It works fine in desktop, tablet and Mobile. However, I found sometimes, the styles are broken and the Animations does not working anymore. I did a research on the internet, a lot of people are saying that is because the style files are not applied. In my situation, it does not sounds that is the case. Finally, I deleted the elements one by one. Then I found it caused by the malform elements
Full story » ]]>Code
class="amc_code_even"> |
| ||
|
Code
RouterModule.forRoot([ | |
{ path: '', component: HomeComponent, pathMatch: 'full' }, | |
{ path: 'counter', component: CounterComponent }, | |
{ path: 'fetch-data', component: FetchDataComponent }, | |
]) |
Code
export class AppRoutes { | |
getRoutes() { | |
return [ | |
{ path: '', component: HomeComponent, pathMatch: 'full' }, | |
{ path: 'counter', component: CounterComponent }, | |
| |
{ path: 'fetch-data', component: FetchDataComponent }, | |
]; | |
} | |
} |
Then in the app.modules.ts, it will import the routes
Code
let appRoutes = new AppRoutes(); | |
RouterModule.forRoot(appRoutes.getRoutes()) |
This approach is more clear
]]>There is not listview in more modern Android SDK. The replacement of this is RecyclerView, that is more flexible, you can set the layout manager, such as LinearLayoutManager or GridLayoutManager, even you can build your own. But that is more powerful, then that is harder to use. The first program I built, I found it only shows the first element. Then I found in the layout resource file of list adapter, the root element cannot set the height to be "match_parent", if you set "match_parent", the first element will be occupied the whole list, then no room for another elements. So the solution is to the height to be the fixed value or "wrap_content.
]]>